It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Form Validation and passing control flow to another script

Form Validation and passing control flow to another script

Postby Daymo on Thu May 15, 2008 12:45 am

I am using a validation script which has the option to pass the control flow to another function once the form has passed the validation. The validation script is in an external file (it is the RSV script from http://www.benjaminkeen.com/software/rsv/).

In it the settings include

Code: Select all
rsv.onCompleteHandler = null;


and the instructions say

his option lets you pass off the control flow to your own function once everything validates properly. This can be handy if you need to perform extra tasks like store information in hidden fields, select values in multi-select boxes and other things prior to submitting the form. All you need to do is enter your function name:

rsv.onComplete = myFinalFunction

Then define your function like so:

function myFinalFunction()
{
// ...
return true;
}

To submit the form your function just needs to return true, otherwise it should return false.


Now I've been trying to add another function to stop double submission, the code I've been using is

Code: Select all
var doubleSubmit=new Boolean();
     doubleSubmit = true;

function submitForm(button) {
   
      if (doubleSubmit) {
         button.value = 'Submitting Form';
         button.disabled = true;
         document.form1.submit();
      }
      else {
        alert ("Form Already Submitted!!");
      }
      return true;
}


Which works on its own but not when I call it from inside the other script by changing the setting to

Code: Select all
rsv.onCompleteHandler =  submitForm;


Does anyone have any ideas please.

Thank you
Daymo
 
Posts: 0
Joined: Thu May 15, 2008 12:32 am

Who is online

Users browsing this forum: No registered users and 4 guests