|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi there, I'm wondering if any of you guys can give me a hand.
I'm using "SpryValidation" for TextFields and List/Menu to validate a form. It normally works fine. However, this time I am trying to send the form to 2 different URLs and unfortunately it does not validate at all. To submit the form to two URLs I add "onsubmit="setTimeout(ReSubmit,1000)" to the <form> tag. <form method="post" name="myform" action="http://www.url_one.com" onsubmit="setTimeout(ReSubmit,1000)"/> And of course the function in the <head> tag: <script language="Javascript"> <!-- function ReSubmit(){ f=document.myform; f.action='http://www.url_two.com; f.submit(); } --> </script> Why is "onsubmit" affecting the validation script linked to the page (e.i..."SpryValidationSelect.js" and SpryValidationSelect.js). Isn't supposed to do the validation before actually clicking on the submit button? Or how can I tell it to check for validation first then submit? Thank you for your time guys... |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
I'm pretty sure at one point or another you guys
are going to come across the same issue. After a little bit of research (yeah...alright!) I found this tutorial that kind of explains what to do when validation doesn't work because of "onSubmit" http://cates-associates.net/tutorial...CS3-forms.html This function ed me solve the problem of validating. <script type="text/javascript"> <!-- // handle form submit & validate function SendForm(myform) { var theForm = typeof myform != 'object' ? document.getElementById(myform): myform; var ret = Spry.Widget.Form.validate(theForm); if (ret) { ReSubmit(); } return false; }; //--> </script> "Spry.Widget.Form.validate" (look in external .js files) is the function that checks validation for all textfields, textareas, list/menus, etc. Thank you |
|
![]() |
| Outils de la discussion | |
|
|