bamfon Posted June 29, 2013 Share Posted June 29, 2013 Before I write anything I will just so I have VERY basic know how of Javascript, don't really use it so have not learnt it Using jquery to validate a simple form, but it keep breaking on the password part, I am sure I done everything by the book and right I plan on adding this to my CMS, I used to do it all by PHP but that way is longer and does not look as nice as jquery does <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8/jquery.validate.min.js"></script> <form id="myform"> <input type="text" name="username" /> <br/> <input type="text" name="email" /> <br/> <input type="text" name="password" /> <br/> <input type="text" name="confirm_password" /> <br/> <input type="submit" /> </form> <a id="docs" href="http://docs.jquery.com/Plugins/Validation" target="_blank">Validation Documentation</a> $(document).ready(function () { $('#myform').validate({ // initialize the plugin rules: { username: { required: true, minlength: 5 }, email: { required: true, email: true }, password: { required: true, minlength: 5, maxlength: 15, ContainsAtLeastOneDigit: true }, confirm_password: { required: true, equalTo: "#password" }, }, messages: { username: { required: "Please enter a username", minlength: "Your username must consist of at least 5 characters" }, password: { required: "Please provide a password", minlength: "Your password must be at between 6 to 14 characters long", maxlength: "Your password must be at between 6 to 14 characters long11", ContainsAtLeastOneDigit: "must contaion one number" }, confirm_password: { required: "Please confirm passwordd", equalTo: "Please enter the same password as above" }, email: "Please enter a valid email address", }, submitHandler: function (form) { // for demo alert('valid form submitted'); // for demo return false; // for demo } }); }); Quote Link to comment https://forums.phpfreaks.com/topic/279700-from-validation-in-jquery/ Share on other sites More sharing options...
dalecosp Posted June 30, 2013 Share Posted June 30, 2013 What does Firebug say?If the error's in Javascript it should be throwing exceptions automagically... Quote Link to comment https://forums.phpfreaks.com/topic/279700-from-validation-in-jquery/#findComment-1438614 Share on other sites More sharing options...
bamfon Posted June 30, 2013 Author Share Posted June 30, 2013 What does Firebug say? If the error's in Javascript it should be throwing exceptions automagically... That's the thing, there no error, when you try to put in password, even if you have between 5-15 characters long and have a number, the message does not go away and page does not submit :S Quote Link to comment https://forums.phpfreaks.com/topic/279700-from-validation-in-jquery/#findComment-1438668 Share on other sites More sharing options...
White_Lily Posted July 4, 2013 Share Posted July 4, 2013 Try running the form in Chrome, as the inspect element in Chrome tells you exactly what line the error is occurring on, and whats causing it to occur. Quote Link to comment https://forums.phpfreaks.com/topic/279700-from-validation-in-jquery/#findComment-1439460 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.