IronicallyMaiden Posted August 5, 2011 Share Posted August 5, 2011 Hi this is my 1st time posting so I hope I'm in the right section. I am trying to make a PHP contact form, at the moment it works but with no validation. I am using a jquery form validation plugin, the validation works fine too. The problem is that the message can't sent because the validation comes 1st and I can't figure out how to call my contactFormProcess.php page from the javascript function once it validates so the message can actually send. I think the problem is that javascript is clientside and php is serverside and I don't think one can link to the other directly. That said is there an alternate way to call my contactFormProcess.php file from the javascript form validator? Quote Link to comment https://forums.phpfreaks.com/topic/243961-phpjavascript-contact-form-validation/ Share on other sites More sharing options...
cunoodle2 Posted August 5, 2011 Share Posted August 5, 2011 Likely the issue is on line 13 of your code. Quote Link to comment https://forums.phpfreaks.com/topic/243961-phpjavascript-contact-form-validation/#findComment-1252801 Share on other sites More sharing options...
msaz87 Posted August 5, 2011 Share Posted August 5, 2011 Show code Quote Link to comment https://forums.phpfreaks.com/topic/243961-phpjavascript-contact-form-validation/#findComment-1252803 Share on other sites More sharing options...
IronicallyMaiden Posted August 6, 2011 Author Share Posted August 6, 2011 Sorry for not showing code, my brain is fried. Basically I want to be able to call action="php/contactFormProcess.php" from the php form from within the javascript function $('#submit').formValidator so once I know everything is valid I can send the message. <link rel="stylesheet" type="text/css" href="assets/styles.css" /> <script type="text/javascript" src="assets/jquery.1.3.2.js"></script> <script type="text/javascript" src="jquery.ufvalidator-1.0.4.js"></script> <script type="text/javascript"> // EXECUTE PLUGIN ON DOM READY - START $(function () { $('#submit').formValidator({ onSuccess : function() { console.log('Success!'); }, scope : '#form-1', errorDiv : '#errorDiv1' }); }); // EXECUTE PLUGIN ON DOM READY - END </script> </head> <body> <div class="container"> <? include("header.php") ?> <div class="main"> <div id="contactForm"> <!--CONTACT FORM--> <form id="form-1" class="form" method="get" action="php/contactFormProcess.php"> <div class="form-row"> <div class="label">Name</div> <div class="input-container"><input name="name" type="text" class="input req-min" minlength="3" maxlength="40" /></div> </div> <div class="form-row"> <div class="label">Email</div> <div class="input-container"><input name="email" type="text" class="input req-email" maxlength="50" /></div> </div> <div class="form-row"> <div class="label">Message</div> <div class="input-container"><textarea name="message" cols="" rows="" class="textarea req-string"></textarea></div> </div> <input id="submitBtn1" value="Send" type="submit" class="sendBtn" /> <div id="errorDiv1" class="error-div"></div> </form> </div> <div class="plane"> <img src="images/plane.png" width="960" height="194" alt="paper plane" /></div> </div> <? include("footer.php") ?> </div> </body> Quote Link to comment https://forums.phpfreaks.com/topic/243961-phpjavascript-contact-form-validation/#findComment-1252993 Share on other sites More sharing options...
radiations3 Posted August 6, 2011 Share Posted August 6, 2011 If you use Dreamweaver then you won't be having these problems INSERTION WITH VALIDATIONS Quote Link to comment https://forums.phpfreaks.com/topic/243961-phpjavascript-contact-form-validation/#findComment-1253051 Share on other sites More sharing options...
IronicallyMaiden Posted August 6, 2011 Author Share Posted August 6, 2011 Problem solved I just started it from scratch mainly relying on php rather than javascript. Thanks to those who replied. Quote Link to comment https://forums.phpfreaks.com/topic/243961-phpjavascript-contact-form-validation/#findComment-1253324 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.