Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have create a form with a few fields, captcha and a submit button.

for now I am using

<pre lang="HTML"> <input class="btn btn-lg" name="Submit" onclick="return validate();" type="submit" value="Submit">


validate function returns if the captcha is same or not . by throwing a message onclick of submit.

The problem now is how do I submit the form ? (I have already used onclick to validate the captcha)
Posted

1 solution

in the validate() function, returning true will result in submission of the form.
// pseudo code
function validate(){
   // code to validate captcha
   if (//outcome of captcha is true//) {
       return true; // form will be submitted
   } else {
       alert(message);
       return false; // form will not be submitted
   }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900