Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

I need to use captcha image in my web application, how do I reload the captcha, if the captcha code is invalid , without clearing form data?

user-image
Question ajoutée par عبدالرزاق رحمون , IT engineer , Ministry of Education
Date de publication: 2016/03/25
Shahzaib Arshad
par Shahzaib Arshad , Chief Technology Officer - Cto , Yalah DMCC

Two methods,

 

1- Submit the form via ajax2- Store the form values in session variablesSubmitting the form via ajax is simple, you send and receive response from the server without page being reloaded so if the captcha is incorrect, you can change the image via ajax request without losing the field values.Another method is to save the form data in session variable as soon as they are received by the server side script and then echo/print the values in the fields, so reloading the page would print the values from the session variables. Once the form is processed, you can clear the session variable.

Gayasuddin Mohammed
par Gayasuddin Mohammed , Advocate , Practicing Law before High Court at Hyderabad

In your validation check, you should validate for captcha codes correctness, if true proceed for further validation of fields data. if false, without clearing the form data, reload the captcha with new image and give a message that image data entered earlier is incorrect and enter the correct one after carefully observing it..like.and pointing the cursor at captcha text input box for entering the data..should work i think so. Thanks.

More Questions Like This