Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Assigning a password to display a hidden form

Avatar

Level 3

Hi,

I'd like to set up a password prompt to make a form that is hidden into visible. What I have is a form with 2 pages. Page 1 has all the fields that the user has to fill out, and page 2 is for admin use only. I have placed a radio button at the end of page 1 with the text "Admin use only". which when clicked, it makes the 2nd page visible. However, I wanted to add a layer of security so that if the user clicks the radio button, it would prompt them to enter a password in order for the Admin only page (page 2) to become visible.

Is that possible???

Thank you for your help!!!!!!!!!!

J

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

I am not overly experienced but I will try. I use formcalc for my

forms, this should work with slight adjustments:

On the button click event place the code

if (xfa.host.response("Password:", "Admin Password") == "password") then

form1.page2.presence = "visible"

endif

You cannot hide the page after it has been shown but this should work.

Let me know if these instructions are not clear enough.

View solution in original post

3 Replies

Avatar

Former Community Member

I have not actually tested this myself so I do not know how much help I will be but no one else has responded so I will take a stab at it.

I think this would be possible using an if statement and xfa.host.response method.  Have an if statement that if the response is correct then the additional page is displayed.

I do not know how secure this would be (for example I can't think of a way to set a limit on the number of wrong attempts), and you would have to set the password in the code and the user would not be able to change it, but hopefully this will be of some help.

Avatar

Level 3

Hi,

Thank you for your reply. I'm not a pro on this so I would need a bit more help I need to be able to prompt for a password and only the correct response would display the hidden form....  Is there anyway you could provide me with the code?

Thank you!!!!

Avatar

Correct answer by
Former Community Member

I am not overly experienced but I will try. I use formcalc for my

forms, this should work with slight adjustments:

On the button click event place the code

if (xfa.host.response("Password:", "Admin Password") == "password") then

form1.page2.presence = "visible"

endif

You cannot hide the page after it has been shown but this should work.

Let me know if these instructions are not clear enough.

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] ----