ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل عبدالرزاق رحمون , IT engineer , Ministry of Education
تاريخ النشر: 2016/03/25
Shahzaib Arshad
من قبل 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
من قبل 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.

المزيد من الأسئلة المماثلة