I am running into a problem when trying to submit a login form. The login button works fine at calling the JavaScript code I wrote to validate the form before using the HTML for submitting my form (action=”…php” method=”post”). However, I don’t think the submit button has actually been defined as a submit button.
The reason this is a problem is because whenever the user types in their login information all they have to do is click the “Go” button on the UIKeyboard and it redirects them to the next page without ever calling the function that validates the form. They could enter nothing and still be able to go to the next webpage.
I am relatively new to programming and this is my first time trying to write an iPhone Web App. So any help with how to redirect the go button so that it calls my JavaScript function would be great because I have no idea how to access the mobile safari keyboard.
If this isn’t possible to do that then could the problem be with the go button not recognizing the login button as an actual submit button?
If you have access to the HTML code, the easiest way would be to add an onSubmit event to your form.
This would make sure the validation method is called before the form is actually submitted.