Date:  07/14/2006 06:37:18 AM Msg ID:  003047
From:  Jeff Grippe Thread:  003041
Subject:  Re: Validate Using AJAX Part 2
I tried that and there is some other problem going on.
 
I put a call to my CheckPW() function in the Validate() which is called from onsubmit.
 
When a user presses enter from the text field for the Password the onsubmit code isn't being called at all. The form is being submitted while the Validate function is bypassed.
 
What is special about the Enter key that causes this behavior? How do I get around it. The onblur code in the text field isn't executed until after the form is submitted and the validate isn't executed at all.
 
Please let me know if you don't understand or can't replicate the problem.
 
Thanks,
Jeff
Sent by FoxWeb Support on 07/11/2006 01:49:15 PM:
If you want to prevent the form from being submitted, you can add JavaScript code to the form's onSubmit event.  The code should return true, unless the password has already been authenticated, in which case it should return false.

FoxWeb Support Team
support@foxweb.com email

Sent by Jeff Grippe on 07/11/2006 07:46:55 AM:
I have a form with a password text field and a submit button.
 
Thanks to your help I have figured out how to validate the password using AJAX without submitting the form.
 
I also figured out how to have the submit button disabled with entry of the correct password making it enabled (DISABLED=false).
 
My last problem is that even with the submit button disabled, the enter key from the password text box tries to submit the form. The onblur code from the text box executes after the onsubmit code from the form.
 
The result is that the user sees an "incorrect password" message even though the password has been entered and is correct. Then the password gets validated and the form is submitted.
 
Is there a way to prevent the ENTER key from submitting the form?
 
Thanks.