MathiVel Posted October 18, 2013 Share Posted October 18, 2013 I have creating a contact form with validation. but i have no idea to validate the contact form which platform. anybody having new idea to validate the contact form pls reply. otherwise tell any good PHP Training Institutes? My friends are recommending this PHP Training Institute Quote Link to comment https://forums.phpfreaks.com/topic/283076-how-to-validate-contact-form-using-java-script/ Share on other sites More sharing options...
Irate Posted October 19, 2013 Share Posted October 19, 2013 (edited) Don't validate anything with JavaScript what you can validate with PHP. Just don't. Edit: ... Of course, I'm implying that your JavaScript implemntation is not found on your server. If it was a server-side implementation of JS, then go ahead. If you mean the client-side JS with the Document Object Model, then forget about it. Edited October 19, 2013 by Irate Quote Link to comment https://forums.phpfreaks.com/topic/283076-how-to-validate-contact-form-using-java-script/#findComment-1454521 Share on other sites More sharing options...
LunarIsSexy Posted October 19, 2013 Share Posted October 19, 2013 Don't validate anything with JavaScript what you can validate with PHP. Just don't. Edit: ... Of course, I'm implying that your JavaScript implemntation is not found on your server. If it was a server-side implementation of JS, then go ahead. If you mean the client-side JS with the Document Object Model, then forget about it. I think he means checking if the user actually input anything in the field when they press submit. If they didn't input anything it shows an error message on top of that field. This would be done with JavaScript, not PHP. Quote Link to comment https://forums.phpfreaks.com/topic/283076-how-to-validate-contact-form-using-java-script/#findComment-1454531 Share on other sites More sharing options...
Irate Posted October 19, 2013 Share Posted October 19, 2013 Right. That is easy, of course. I would need to see the actual form you have created for that, MathiVel. Quote Link to comment https://forums.phpfreaks.com/topic/283076-how-to-validate-contact-form-using-java-script/#findComment-1454542 Share on other sites More sharing options...
fastsol Posted October 19, 2013 Share Posted October 19, 2013 I distribute a contact form with jquery, ajax and php validation methods along with HTML5 attributes for certain browser validation. You can take some clues from it if you want, or use it if you also want. http://amecms.com/article/Easy-to-use-contact-form-with-validation Quote Link to comment https://forums.phpfreaks.com/topic/283076-how-to-validate-contact-form-using-java-script/#findComment-1454563 Share on other sites More sharing options...
cyberRobot Posted October 20, 2013 Share Posted October 20, 2013 I think he means checking if the user actually input anything in the field when they press submit. If they didn't input anything it shows an error message on top of that field. This would be done with JavaScript, not PHP. This can be accomplished with PHP. You would just re-display the form if there were errors, populate it with the information submitted, and display the necessary error notices. The only benefit of using a client-side solution, like JavaScript, is that the page doesn't need to be reloaded before the errors are displayed. JavaScript could display the errors on the fly. Just be aware that JavaScript can be turned off, so it's a good idea to also validate using a server-side solution like PHP. Quote Link to comment https://forums.phpfreaks.com/topic/283076-how-to-validate-contact-form-using-java-script/#findComment-1454577 Share on other sites More sharing options...
LunarIsSexy Posted October 20, 2013 Share Posted October 20, 2013 This can be accomplished with PHP. You would just re-display the form if there were errors, populate it with the information submitted, and display the necessary error notices. The only benefit of using a client-side solution, like JavaScript, is that the page doesn't need to be reloaded before the errors are displayed. JavaScript could display the errors on the fly. Just be aware that JavaScript can be turned off, so it's a good idea to also validate using a server-side solution like PHP. Yes but its always good to be double-careful Plus if you don't use JS than it isn't very interactive and it keeps it basic. Quote Link to comment https://forums.phpfreaks.com/topic/283076-how-to-validate-contact-form-using-java-script/#findComment-1454578 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.