View Single Post
Old 20-05-2011, 04:58 PM   #5
Ohne Mitleid
Brazen Pangolin
 
Ohne Mitleid's Avatar


 
Join Date: Dec 2010
Location: ,
Posts: 202
Default

Code:
function validateForm(myForm)
{
if (failure conditions)
  {
  show error message;
  return false;
  }
}

<form onsubmit="return validateForm(this);"></form>
This is the modified code from the first example. Follow the logic. There is no need for the return true. Onsubmit sends the input data to the validateForm function. The function initially checks for failure conditioins. If it fails, the error message is displayed, a false conditions response is returned and your code should be set up to continue looping until a return false response is not returned. If the function were to get past the failure conditions, it is assumed to be a success (return true).

At least that's how I understand it.
Ohne Mitleid is offline                         Send a private message to Ohne Mitleid
Reply With Quote