I have a form (signup.php) that pops up in a nyroModal window when I click a button:
<input value="Edit" class="nyroModal" type="button" href="signup.php">
I would like to use some form of AJAX validation (to check if the user name has been taken, for example) before submitting the form.
I had the following in mind: When the user clicks the 'submit' button. it calls javascript function with onClick
that sends the required fields to a PHP script, which returns whether the fields are valid. Then, if the field is invalid, it notifies the user, but when the field is valid, it submits the form via something like $('#formid').submit();
. Easy enough in theory.
BUT
Problem is, when the nyroModel gets the new form from a URL, and creates a div in the DOM with the contents in it, Firefox completely ignores any <script>
tags. Using Firebug, I can see it actually gets the <script>
tags with the response, but Firefox ignores them. Also, I can't create a jQuery function on the page that the model is called from, because when the document is created, the form doesn't exist in DOM yet.
Any ideas how to solve this?