Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

problem with postSubmit event

Avatar

Former Community Member

I have a submit button in my form.  Just a regular button set to submit http data to a url in utf-8 encoding.  It submits to my server fine, etc.

The problem I'm having is that I want the form to lock AFTER it is submitted so the user cannot edit it again.

I have tried putting javascript in a postSubmit event ....  form1.access="protected";  .... for example.  It works.  When the user clicks on submit the form will submit (IF all the fields set to required are filled in,) then all the fields in the form are protected.  This is great.

The problem I'm having is when a user didn't fill out a required field and hits submit.  In addition to outlining the required fields in red and informing the user of his/her error...it proceeds to lock all the fields so the user can't fix it.  This is driving me nuts.  It's the javascript suppose to execute on POST submit?  If all the required fields are not filled in then it is not submitting yet and should not have done this.

How in the world can I get all the fields in my form to be protected (i.e. lock or readOnly,) but AFTER all the required fields are indeed filled in and the form has ACTUALLY submitted?

I spent far too long on this problem already, lol.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You could wrap the script in the postSubmit event in its own validation if statement:

if (form1.execValidate() == true)

{

     // your locking script here...

}

Hope that helps,

Niall

Assure Dynamics

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

You could wrap the script in the postSubmit event in its own validation if statement:

if (form1.execValidate() == true)

{

     // your locking script here...

}

Hope that helps,

Niall

Assure Dynamics

Avatar

Level 7

Happy Holidays!!!!

How and what  you need to submit( http data to a url in utf-8 encoding) a form via a server?

Thank you