Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

Restrict Button Access

Avatar

Level 2

Hello,

I have a form in which I want to add submit buttons that will route a form between several users. Each time a user clicks the button, the button will become inactive. Can this be done and can some steer me in the right direction for scripting?

Thanks a bunch.

Joe

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Your field is called GST not submitGST. If you hover over the button a popup will appear giving you the name of the object. Or you can use this.access = "readOnly" as the "this" refers to the field that has focus.

Paul

View solution in original post

6 Replies

Avatar

Former Community Member

On the postSubmit event I woudl add the code:

submitButtonName.access = "readOnly"

Paul

Avatar

Level 2

Hi Paul,

my button is called SubmitGST. I assume that this would replace the "submit" in the script - correct? Also, do I need any other scripting to call this to action? It didn't work when I tested.

Thanks!

Joe

Avatar

Former Community Member

Thats all you need to do .....if you can't get it to work post your form and I will have a look.

Paul

Avatar

Level 2

Hi Paul,

Attached is my form. Take a look.

Joe

Avatar

Correct answer by
Former Community Member

Your field is called GST not submitGST. If you hover over the button a popup will appear giving you the name of the object. Or you can use this.access = "readOnly" as the "this" refers to the field that has focus.

Paul

Avatar

Level 2

Thanks Paul.

I moved the scrip to preSubmit as I needed to have the submitted file restricted. Now I will attempt to use the same script on some of the form fields so that once entered they are become read only. I saw an article about how to grey out a field but it was with a radio button.

Thanks again.

Joe

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----