I have a form containing name,email,message and captcha fields.
I can submit the form and can verify the captcha at server side, In case everything is OK i have to display a jsp using requestDispatcher. Everything works fine if captcha is correct but if it is incorrect i am redirecting user onto the same page where the form is displayed so that user can reenter the captcha. But the main problem with this approach is the form get’s cleared, that means user have to refill the whole thing again.
How can i avoid this thing so that user don’t require to refill the form.
And is their any other better approach for this.
Iv’e already tried making an ajax call to validate captcha but have got some problem with that approach. Unable to submit form in jquery ajax callback function
You can do something like this, call click event on some div say ‘submit’, then call ajax call and get the result. Depending upon result you can decide whether to submit the form or not.
submit is DIV
printCoupon is form