My Account   Contact Us    
  
» HomeProductsSupportDeveloper CommunityCompany
Form Validation

Form Validation example


ActivEdit binds the onSubmit() event to ae_onSubmit(). When the form that contains an ActivEdit instance is submitted, the contents of the instance are transferred to a hidden textarea.

This becomes a problem when you add your own onSubmit() handler in the form because ae_onSubmit() takes precedence over your event handler and submits the form.

To workaround this, you can unregister the event listener and call ae_onSubmit() in the truth clause of your validation function.

You need to make sure the form and all instance of ActivEdit have already been loaded, so add the following to the <body> element:

onLoad="removeListener()"

Next, place the removeListener() function in the form page and replace formName with the actual value you have in your form name attribute and change the function being registered to the event to your function name.

function removeListener() {
 document.testForm.onsubmit = functionName;
}.

Make sure you call ae_onSubmit() in your handler as in the following example:

function functionName() {
 if (aeObjects.fieldname.DOM.body.innerHTML.length == 0) {
   alert("Please enter some content.");
   aeObjects.fieldname.focus();
   aeObjects.fieldname.DOM.body.focus();
   return false;
  }
 ae_onSubmit();
 return true;
}

 

 

Search Knowledge Base:
Sign up for our newsletter: | Subscribe with RSS: RSS
© ActivSoftware 1999 to 2005 | Privacy Statement