javascript - Calling two functions in Firefox -


when submit web form call 2 functions, this:

<form action="myaction" name="myform" method="post" onsubmit="return submithandler(this) && validate(this)"> 

the javascript:

function submithandler (form) { // function replaces diacritical marks correct form return true; };  function validate(form) {  // huge validation code }; 

works fine in browsers, except firefox; browser submithandler(this) part, ignores validate(this). if make form tag (below), validation ignores submithandler(this).

<form action="myaction" name="myform" method="post" onsubmit="return validate(this) && submithandler(this)"> 

any ideas please?

edit:

the firefox problem must within script? maybe var form = event.target; ? please see here: change characters on form submit

// script replaces instances of letter (or whatever) inside text fields in form.

 function submithandler (form) {  var form = event.target;  var i, l;   (i = 0, l = form.elements.length; < l; += 1) {  if (form.elements[i].type === 'text') {   form.elements[i].value = form.elements[i].value.replace(/Ş/g, 'Ș');   form.elements[i].value = form.elements[i].value.replace(/ş/g, 'ș');   form.elements[i].value = form.elements[i].value.replace(/Ţ/g, 'Ț');   form.elements[i].value = form.elements[i].value.replace(/ţ/g, 'ț');     }     }      return true;       }; 

call validate function inside submithandler function:

function submithandler (form) { // function replaces diacritical marks correct form if(isvalid(form)){    return true; } else{    return false; } };        function isvalid(form) {      // huge validation code     //validation code: must return true if valid        if(valid){      return true;     } else {     return false;     }     }; 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -