By: Sylvain BONNEFON user 04 Jun 2021 at 4:02 a.m. CDT

3 Responses
Sylvain BONNEFON gravatar
Hello, When a field is not well fill in an authentication form, after submitting the htm page is reload with an error (wich is normal). Th problem is that all the informations get in the script logic are lost (prepareforstep etc.). So my form xhtml page is not able to have the needed information, as the parameter store in Identity for in my case. What could I do to keep my identity parameters, and other informations triggers but the python script after a bad form submission ? I tried to store data in cacheService but I don't know how to get this information from the JSF template. Maybe their is a simple explanation and solution but I don't see it. thanks for your help :) Have a nice day ![](https://files.slack.com/files-pri/T0151C7G07K-F024119AP5Z/image.png) ![](https://files.slack.com/files-pri/T0151C7G07K-F024QJQALHW/image.png)

By Madhumita Subramaniam staff 07 Jun 2021 at 7:02 a.m. CDT

Madhumita Subramaniam gravatar
Hey Sylviann, Do this. The example scenario is - User enters the username and leaves the password field blank. On submit button, the login form is re-shown to the user and the username is pre-populated in the form - Inside the script (in the authenticate method) you will have something like this ``` if password is None: identity.setWorkingParameter("username",user_name) ``` - Inside login.xhtml, In window.onload() method do this: ``` var retainedUserName = #{identity.sessionId.sessionAttributes['username']}; document.getElementById("loginForm:username").value = retainedUserName; ``` I hope this helps. Have a good day!

By Sylvain BONNEFON user 07 Jun 2021 at 7:12 a.m. CDT

Sylvain BONNEFON gravatar
Hi Madhu, Thank you for your answer. But, my problem is when the user click on submit but the username field was leave empty. (In this case the python script doesn't seem to be called at all, but the validator detect that something is wrong with the form (the username in this case) and reload the page without the 'asr_text' information previously triggered byt the python script) https://gluu.pre.whispeak.io/oxauth/whispeak_login.htm

By Sylvain BONNEFON user 07 Jun 2021 at 7:17 a.m. CDT

Sylvain BONNEFON gravatar
But I will try your JS trick for this asr_text issue thanks for that :). I juste hoped we could have a less hacky technique to not lose Identity in between form page relaod.