[jQuery] Re: Validation rules using alert() instead of message text
i got the basic sample there: http://stackoverflow.com/questions/1458605/how-to-display-messages-in-invalidhandler-in-jquery-validator
[jQuery] Re: Validation on a Modal form does not work
We have a similar problem. When trying to validate the modal dialog box decides its tired and goes away. Not sure how to do validation on the form without it disappearing... On Jan 7, 10:39 am, Elan Noy elan...@gmail.com wrote: I have amodalform that I want to validate. Themodalis based on the simplemodalplugin and thevalidationis based onvalidationplugin. Thevalidationworks well on a regular (nonmodal) form. ANy ideas? script type=text/javascript jQuery.validator.addMethod(zip, function(value, element) { return this.optional(element) || value.match(/^((\d{5}- \d{4})|(\d{5})|([a-z]\d[a-z]\s?\d[a-z]\d))$/i); }, US or Canadian postal code only); $(document).ready(function(){ getaddressBook(); $(#addAddress).validate({ rules: { emzip: { required: true, zip: true, }, }, }); }); /script
Re: [jQuery] Re: Validation on a Modal form does not work
On Jan 7, 10:39 am, Elan Noy elan...@gmail.com wrote: I have amodalform that I want to validate. Themodalis based on the simplemodalplugin and thevalidationis based onvalidationplugin. Thevalidationworks well on a regular (nonmodal) form. ANy ideas? script type=text/javascript jQuery.validator.addMethod(zip, function(value, element) { return this.optional(element) || value.match(/^((\d{5}- \d{4})|(\d{5})|([a-z]\d[a-z]\s?\d[a-z]\d))$/i); }, US or Canadian postal code only); $(document).ready(function(){ getaddressBook(); $(#addAddress).validate({ Could it be simply that the document is already ready so your ready function is not being called? Try executing the contents of the ready function inline? Nathan
[jQuery] Re: Validation
Try this: script type=text/javascript $(document).ready(function() { $(#autoSumForm).validate({ rules: { p1001: {number: true}, p1002: {number: true} }, messages: { p1001: , p1002: }, submitHandler: function(form) { jQuery(form).ajaxSubmit(); } }); }); /script On Jan 13, 12:03 am, Seth seth.wilsch...@gmail.com wrote: Hello, I'm using jquery with the form and validation plugins. I have this: script type=text/javascript $(document).ready(function() { $(#autoSumForm).validate({ rules: { p1001: {number: true}, p1002: {number: true} }, messages: { p1001: , p1002: } }); $('#autoSumForm').ajaxForm(function() { alert(Time submitted.); }); }); /script The validation and the form submit both work, but the form submits even if not valid. How do I combine the two? Thanks.
[jQuery] Re: Validation Plugin
Got any code to show us? You need an event to fire off the remote call, either onBlur or onClick of a button. You examine the returned data and act accordingly. Adrian On Jan 10, 12:28 pm, Richard Beacroft r_beacr...@hotmail.com wrote: People enter an address to lookup on a google map, this makes an asynchronous call and will either return a lat/longitude or not. if not, i want to display an error to the user that an address could not be found. How do I go about this? I've not managed to get it working using the remote attribute as I really need to call a client-side js function which will in turn make the async call. Any suggestions? Regards, Rik
[jQuery] Re: (validation): remote rule causes submit to abort, fix included
No, it does not submit the form after the async request finishes. (I'm using the latest 1.6) Ken On Dec 21, 6:30 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: The plugin will submit the form after the async request finishes. The remaining problem is that any submit-button won't be submitted. Maybe thats the problem you had? Jörn On Mon, Dec 21, 2009 at 8:15 AM, KenGreer k...@dancesoft.com wrote: With the validation plugin (http://bassistance.de/jquery-plugins/ jquery-plugin-validation/http://bassistance.de/jquery-plugins/%0Ajquery-plugin-validation/) I included two remote rules to check username and e-mail. If my form is loaded such that the username and e- mail are already filled in, and, therefore, have not yet been validated, and I click SUBMIT, validation proceeds just fine, but the form does NOT submit! A second click of the submit button, however, then works. I speculated that this was because of pending ajax calls aborting the submit. It seems my speculation held true. Right after my $ (document).ready(function() { ... I added the code: $.ajaxSetup( { async: false } ); to make the remote ajax calls synchronous and this fixed the problem. Now clicking submit performs the validation and really does submit. Hopefully a more elegant solution will be found in the validation plugin itself, but as a jquery newbie, I found reading the validation plugin code daunting!
[jQuery] Re: validation method not working in ie
Has anyone any clue for this? On Nov 27, 5:09 pm, hcvitto hcvi...@gmail.com wrote: Hi i'm using the validation plugin on a form. I added three methods to check that three select value are not equal but it doesn't work in ie. here's the page http://www.fepgroup.it/community/registrati__.php Any idea why? Thanks Vittorio
Re: [jQuery] Re: validation: how do I call a function to perform after a validation is done?
Ok I'm using this invalidHandler: function(form, validator) { PossitionStuff.possitionErrors(); }, And it works but it doesn't fire till the second validation I need it to fire on the first go around too On 11/18/09 4:06 PM, StephenJacob turnstylecreat...@gmail.com wrote: Hmm, i'm not really sure how to pull that off. I would look into the showErrors option or possibly the Valid function. http://docs.jquery.com/Plugins/Validation/validate http://docs.jquery.com/Plugins/Validation/valid Good luck and let us know how things turn out for ya! On Nov 18, 3:47 pm, Atkinson, Sarah sarah.atkin...@cookmedical.com wrote: I want the function to trigger when there are errors it's to alter the position of both the errors and other elements on the page. So I got the function to fire but I can't seem to changes the css on the error boxes. $('label .error').css({'left' : basePossitionOffset.left}); Does not work. I should be able to alter the error messages just like anyother element in the DOM right? On 11/18/09 3:34 PM, StephenJacob turnstylecreat...@gmail.com wrote: It depends on your method of validation. Here is the form/validation system I use for my contact form. Hope this helps! script type=text/javascript src=js/jquery-1.3.2.min.js/script script type=text/javascript src=js/jquery.validate.js/script script type=text/javascript src=js/jquery.form.js/script script type=text/javascript $(document).ready(function() { $(#contactForm).validate({ rules: { fullname: { required: true, minlength: 2 }, email: { required: true, email: true }, company: { required: true, minlength: 2 }, phone: { required: true, minlength: 2 }, }, messages: { fullname: 'span class=errorPlease enter your bfull name/b./ span', email: 'span class=errorPlease enter a valid bemail address/ b./span', company: 'span class=errorPlease enter your bcompany/b./ span', phone: 'span class=errorPlease enter your bphone number/b./ span' }, submitHandler: function(form) { $('#contactForm').ajaxSubmit({ resetForm: true, target: '#success', success: function() { $(#success).fadeIn('slow').fadeTo(5000, 1).fadeOut('slow'); } }); } }); }); /script form id=contactForm method=POST action=process.php //FORM GOES HERE /form On Nov 18, 3:08 pm, Atkinson, Sarah sarah.atkin...@cookmedical.com wrote: Do I have to create a custom method and stick a function in there?
[jQuery] Re: validation: how do I call a function to perform after a validation is done?
It depends on your method of validation. Here is the form/validation system I use for my contact form. Hope this helps! script type=text/javascript src=js/jquery-1.3.2.min.js/script script type=text/javascript src=js/jquery.validate.js/script script type=text/javascript src=js/jquery.form.js/script script type=text/javascript $(document).ready(function() { $(#contactForm).validate({ rules: { fullname: { required: true, minlength: 2 }, email: { required: true, email: true }, company: { required: true, minlength: 2 }, phone: { required: true, minlength: 2 }, }, messages: { fullname: 'span class=errorPlease enter your bfull name/b./ span', email: 'span class=errorPlease enter a valid bemail address/ b./span', company: 'span class=errorPlease enter your bcompany/b./ span', phone: 'span class=errorPlease enter your bphone number/b./ span' }, submitHandler: function(form) { $('#contactForm').ajaxSubmit({ resetForm: true, target: '#success', success: function() { $(#success).fadeIn('slow').fadeTo(5000, 1).fadeOut('slow'); } }); } }); }); /script form id=contactForm method=POST action=process.php //FORM GOES HERE /form On Nov 18, 3:08 pm, Atkinson, Sarah sarah.atkin...@cookmedical.com wrote: Do I have to create a custom method and stick a function in there?
Re: [jQuery] Re: validation: how do I call a function to perform after a validation is done?
I want the function to trigger when there are errors it's to alter the position of both the errors and other elements on the page. So I got the function to fire but I can't seem to changes the css on the error boxes. $('label .error').css({'left' : basePossitionOffset.left}); Does not work. I should be able to alter the error messages just like anyother element in the DOM right? On 11/18/09 3:34 PM, StephenJacob turnstylecreat...@gmail.com wrote: It depends on your method of validation. Here is the form/validation system I use for my contact form. Hope this helps! script type=text/javascript src=js/jquery-1.3.2.min.js/script script type=text/javascript src=js/jquery.validate.js/script script type=text/javascript src=js/jquery.form.js/script script type=text/javascript $(document).ready(function() { $(#contactForm).validate({ rules: { fullname: { required: true, minlength: 2 }, email: { required: true, email: true }, company: { required: true, minlength: 2 }, phone: { required: true, minlength: 2 }, }, messages: { fullname: 'span class=errorPlease enter your bfull name/b./ span', email: 'span class=errorPlease enter a valid bemail address/ b./span', company: 'span class=errorPlease enter your bcompany/b./ span', phone: 'span class=errorPlease enter your bphone number/b./ span' }, submitHandler: function(form) { $('#contactForm').ajaxSubmit({ resetForm: true, target: '#success', success: function() { $(#success).fadeIn('slow').fadeTo(5000, 1).fadeOut('slow'); } }); } }); }); /script form id=contactForm method=POST action=process.php //FORM GOES HERE /form On Nov 18, 3:08 pm, Atkinson, Sarah sarah.atkin...@cookmedical.com wrote: Do I have to create a custom method and stick a function in there?
[jQuery] Re: validation: how do I call a function to perform after a validation is done?
Hmm, i'm not really sure how to pull that off. I would look into the showErrors option or possibly the Valid function. http://docs.jquery.com/Plugins/Validation/validate http://docs.jquery.com/Plugins/Validation/valid Good luck and let us know how things turn out for ya! On Nov 18, 3:47 pm, Atkinson, Sarah sarah.atkin...@cookmedical.com wrote: I want the function to trigger when there are errors it's to alter the position of both the errors and other elements on the page. So I got the function to fire but I can't seem to changes the css on the error boxes. $('label .error').css({'left' : basePossitionOffset.left}); Does not work. I should be able to alter the error messages just like anyother element in the DOM right? On 11/18/09 3:34 PM, StephenJacob turnstylecreat...@gmail.com wrote: It depends on your method of validation. Here is the form/validation system I use for my contact form. Hope this helps! script type=text/javascript src=js/jquery-1.3.2.min.js/script script type=text/javascript src=js/jquery.validate.js/script script type=text/javascript src=js/jquery.form.js/script script type=text/javascript $(document).ready(function() { $(#contactForm).validate({ rules: { fullname: { required: true, minlength: 2 }, email: { required: true, email: true }, company: { required: true, minlength: 2 }, phone: { required: true, minlength: 2 }, }, messages: { fullname: 'span class=errorPlease enter your bfull name/b./ span', email: 'span class=errorPlease enter a valid bemail address/ b./span', company: 'span class=errorPlease enter your bcompany/b./ span', phone: 'span class=errorPlease enter your bphone number/b./ span' }, submitHandler: function(form) { $('#contactForm').ajaxSubmit({ resetForm: true, target: '#success', success: function() { $(#success).fadeIn('slow').fadeTo(5000, 1).fadeOut('slow'); } }); } }); }); /script form id=contactForm method=POST action=process.php //FORM GOES HERE /form On Nov 18, 3:08 pm, Atkinson, Sarah sarah.atkin...@cookmedical.com wrote: Do I have to create a custom method and stick a function in there?
[jQuery] Re: Validation plugin rules() ???
http://docs.jquery.com/Plugins/Validation/Methods Also, I found it was worth while to look into jquery.validation.js code. On Nov 17, 8:55 am, Atkinson, Sarah sarah.atkin...@cookmedical.com wrote: Is there a list somewhere of what the options are for the rules (required, email) I can't seem to find more info on this in the jquery site.
[jQuery] Re: Validation Plugin + jNice
Yeah.. www.racedaystaff.com - log in as jorn/jorn then click proceed to site then click register at the top. Thanks for looking at this ! On Nov 13, 3:51 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Do you have a testpage? Jörn On Fri, Nov 13, 2009 at 4:40 PM, Samuurai djbe...@gmail.com wrote: I'm having a strange problem with jNice and the validation plugin. Probably the easiest way to describe the error is by giving an example. I load the page with my form on it, then without typing anything, I click submit. The jQuery validation plugin puts errors around my fields saying This field is required. However, when I try to type something into the input fields to satisfy the validation, I can type a couple of letters, three or four if i'm really fast, but as the validation plugin removes the error box, it shifts focus away from the input box. Strangely, this same behaviour continues on the same field even after the error box has been removed.. the focus gets 'stolen'. Has anyone had any experience using jQuery validation plugin with jNice?
[jQuery] Re: Validation Plugin + jNice
Oh - Log in as jorn/jorn On Nov 13, 3:58 pm, Samuurai djbe...@gmail.com wrote: Yeah.. www.racedaystaff.com- log in as jorn/jorn then click proceed to site then click register at the top. Thanks for looking at this ! On Nov 13, 3:51 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Do you have a testpage? Jörn On Fri, Nov 13, 2009 at 4:40 PM, Samuurai djbe...@gmail.com wrote: I'm having a strange problem with jNice and the validation plugin. Probably the easiest way to describe the error is by giving an example. I load the page with my form on it, then without typing anything, I click submit. The jQuery validation plugin puts errors around my fields saying This field is required. However, when I try to type something into the input fields to satisfy the validation, I can type a couple of letters, three or four if i'm really fast, but as the validation plugin removes the error box, it shifts focus away from the input box. Strangely, this same behaviour continues on the same field even after the error box has been removed.. the focus gets 'stolen'. Has anyone had any experience using jQuery validation plugin with jNice?
[jQuery] Re: Validation Plugin + jNice
Sorry - I have a goldfish memory today. - Repeating myself :p On Nov 13, 4:01 pm, Samuurai djbe...@gmail.com wrote: Oh - Log in as jorn/jorn On Nov 13, 3:58 pm, Samuurai djbe...@gmail.com wrote: Yeah.. www.racedaystaff.com-log in as jorn/jorn then click proceed to site then click register at the top. Thanks for looking at this ! On Nov 13, 3:51 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Do you have a testpage? Jörn On Fri, Nov 13, 2009 at 4:40 PM, Samuurai djbe...@gmail.com wrote: I'm having a strange problem with jNice and the validation plugin. Probably the easiest way to describe the error is by giving an example. I load the page with my form on it, then without typing anything, I click submit. The jQuery validation plugin puts errors around my fields saying This field is required. However, when I try to type something into the input fields to satisfy the validation, I can type a couple of letters, three or four if i'm really fast, but as the validation plugin removes the error box, it shifts focus away from the input box. Strangely, this same behaviour continues on the same field even after the error box has been removed.. the focus gets 'stolen'. Has anyone had any experience using jQuery validation plugin with jNice?
Re: [jQuery] Re: Validation Plugin + jNice
Looks like jNice is causing that issue. Did you try removing that to see what happens? Jörn On Fri, Nov 13, 2009 at 4:58 PM, Samuurai djbe...@gmail.com wrote: Yeah.. www.racedaystaff.com - log in as jorn/jorn then click proceed to site then click register at the top. Thanks for looking at this ! On Nov 13, 3:51 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Do you have a testpage? Jörn On Fri, Nov 13, 2009 at 4:40 PM, Samuurai djbe...@gmail.com wrote: I'm having a strange problem with jNice and the validation plugin. Probably the easiest way to describe the error is by giving an example. I load the page with my form on it, then without typing anything, I click submit. The jQuery validation plugin puts errors around my fields saying This field is required. However, when I try to type something into the input fields to satisfy the validation, I can type a couple of letters, three or four if i'm really fast, but as the validation plugin removes the error box, it shifts focus away from the input box. Strangely, this same behaviour continues on the same field even after the error box has been removed.. the focus gets 'stolen'. Has anyone had any experience using jQuery validation plugin with jNice?
[jQuery] Re: Validation Plugin + jNice
Strangely, It seems to be doing it even after removing jNice. - I've updated the test site. On Nov 13, 4:23 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Looks like jNice is causing that issue. Did you try removing that to see what happens? Jörn On Fri, Nov 13, 2009 at 4:58 PM, Samuurai djbe...@gmail.com wrote: Yeah.. www.racedaystaff.com- log in as jorn/jorn then click proceed to site then click register at the top. Thanks for looking at this ! On Nov 13, 3:51 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Do you have a testpage? Jörn On Fri, Nov 13, 2009 at 4:40 PM, Samuurai djbe...@gmail.com wrote: I'm having a strange problem with jNice and the validation plugin. Probably the easiest way to describe the error is by giving an example. I load the page with my form on it, then without typing anything, I click submit. The jQuery validation plugin puts errors around my fields saying This field is required. However, when I try to type something into the input fields to satisfy the validation, I can type a couple of letters, three or four if i'm really fast, but as the validation plugin removes the error box, it shifts focus away from the input box. Strangely, this same behaviour continues on the same field even after the error box has been removed.. the focus gets 'stolen'. Has anyone had any experience using jQuery validation plugin with jNice?
Re: [jQuery] Re: Validation Plugin + jNice
Then this: ,success: function(element){ 157 var errorDiv = element.parents('.error'); 158 element.remove(); 159 errorDiv.siblings().remove(); 160 errorDiv.replaceWith(errorDiv.children()); 161 } You replace the div? That causing the DOM to rerender, including the input, killing the focus. Jörn On Fri, Nov 13, 2009 at 6:17 PM, Samuurai djbe...@gmail.com wrote: Strangely, It seems to be doing it even after removing jNice. - I've updated the test site. On Nov 13, 4:23 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Looks like jNice is causing that issue. Did you try removing that to see what happens? Jörn On Fri, Nov 13, 2009 at 4:58 PM, Samuurai djbe...@gmail.com wrote: Yeah.. www.racedaystaff.com- log in as jorn/jorn then click proceed to site then click register at the top. Thanks for looking at this ! On Nov 13, 3:51 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Do you have a testpage? Jörn On Fri, Nov 13, 2009 at 4:40 PM, Samuurai djbe...@gmail.com wrote: I'm having a strange problem with jNice and the validation plugin. Probably the easiest way to describe the error is by giving an example. I load the page with my form on it, then without typing anything, I click submit. The jQuery validation plugin puts errors around my fields saying This field is required. However, when I try to type something into the input fields to satisfy the validation, I can type a couple of letters, three or four if i'm really fast, but as the validation plugin removes the error box, it shifts focus away from the input box. Strangely, this same behaviour continues on the same field even after the error box has been removed.. the focus gets 'stolen'. Has anyone had any experience using jQuery validation plugin with jNice?
[jQuery] Re: Validation Plugin + jNice
Ahhh... Ok, I might opt for just putting an error message after the element instead then rather than creating a box like i'm doing now. Many thanks Jorn for your help! On Nov 13, 5:43 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Then this: ,success: function(element){ 157 var errorDiv = element.parents('.error'); 158 element.remove(); 159 errorDiv.siblings().remove(); 160 errorDiv.replaceWith(errorDiv.children()); 161 } You replace the div? That causing the DOM to rerender, including the input, killing the focus. Jörn On Fri, Nov 13, 2009 at 6:17 PM, Samuurai djbe...@gmail.com wrote: Strangely, It seems to be doing it even after removing jNice. - I've updated the test site. On Nov 13, 4:23 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Looks like jNice is causing that issue. Did you try removing that to see what happens? Jörn On Fri, Nov 13, 2009 at 4:58 PM, Samuurai djbe...@gmail.com wrote: Yeah.. www.racedaystaff.com-log in as jorn/jorn then click proceed to site then click register at the top. Thanks for looking at this ! On Nov 13, 3:51 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Do you have a testpage? Jörn On Fri, Nov 13, 2009 at 4:40 PM, Samuurai djbe...@gmail.com wrote: I'm having a strange problem with jNice and the validation plugin. Probably the easiest way to describe the error is by giving an example. I load the page with my form on it, then without typing anything, I click submit. The jQuery validation plugin puts errors around my fields saying This field is required. However, when I try to type something into the input fields to satisfy the validation, I can type a couple of letters, three or four if i'm really fast, but as the validation plugin removes the error box, it shifts focus away from the input box. Strangely, this same behaviour continues on the same field even after the error box has been removed.. the focus gets 'stolen'. Has anyone had any experience using jQuery validation plugin with jNice?
[jQuery] Re: (validation) Validation plugin submitHandler
Right, thanks. I mentioned that in my initial post. But if I rename the submit-button, if you click the Cancel button, that value of cancel=Cancel will not get sent in the post. Any ideas why? On Nov 12, 2:05 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Use a different name for the submit-button. Using name=submit you override the actual submit-function of the form. Keep in mind that in the DOM API, you can access any form element as a property of the form, referenced by name. Jörn On Thu, Nov 12, 2009 at 8:48 PM, mcrawford mcrawf...@gmail.com wrote: I'm totally stumped with the submitHandler. Here is my test page, down below. I'm using PHP just to print out the form variables but obviously you could adapt the HTML for anything. Notice that I have set my Submit button to have name=submit which means that, in the submitHandler, form.submit() is not a function. I get a JavaScript error on that line, but (and this is what I can't figure out), the form still submits. I can change the Submit button to have a different name, like name=sbmt. That avoids the JS error on the form.submit() line. But then (and I don't get this either), if you click the Cancel button, that value of cancel=Cancel will not get sent in the post. With the Submit button named submit the cancel=Cancel gets posted correctly when you click on that button. ?php if (!empty($_POST)) { print_r($_POST); } ? html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head titleTEST/title meta http-equiv=Content-Type content=text/html; charset=utf-8/ script type=text/javascript src=/js/jquery-1.3.2.js/script script type=text/javascript src=/js/jquery-validate/ jquery.validate.js/script /head body form action=test-validate.php method=post id=the-form input type=hidden name=hidden value=something/ input class=button type=submit name=submit value=Do it now!/ input class=button cancel type=submit name=cancel value=Cancel/ /form script type=text/javascript $(function() { // VALIDATION $(#the-form).validate({ submitHandler: function(form) { $('input[name=submit]', '#the-form').attr('disabled', 'disabled'); form.submit(); } }); }); /script /body /html
[jQuery] Re: (validation) Validation plugin submitHandler
Also, that doesn't explain why the form still submits when I call form.submit(). Since submit is no longer a function, the form should never get submitted in that case. On Nov 12, 2:05 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Use a different name for the submit-button. Using name=submit you override the actual submit-function of the form. Keep in mind that in the DOM API, you can access any form element as a property of the form, referenced by name. Jörn On Thu, Nov 12, 2009 at 8:48 PM, mcrawford mcrawf...@gmail.com wrote: I'm totally stumped with the submitHandler. Here is my test page, down below. I'm using PHP just to print out the form variables but obviously you could adapt the HTML for anything. Notice that I have set my Submit button to have name=submit which means that, in the submitHandler, form.submit() is not a function. I get a JavaScript error on that line, but (and this is what I can't figure out), the form still submits. I can change the Submit button to have a different name, like name=sbmt. That avoids the JS error on the form.submit() line. But then (and I don't get this either), if you click the Cancel button, that value of cancel=Cancel will not get sent in the post. With the Submit button named submit the cancel=Cancel gets posted correctly when you click on that button. ?php if (!empty($_POST)) { print_r($_POST); } ? html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head titleTEST/title meta http-equiv=Content-Type content=text/html; charset=utf-8/ script type=text/javascript src=/js/jquery-1.3.2.js/script script type=text/javascript src=/js/jquery-validate/ jquery.validate.js/script /head body form action=test-validate.php method=post id=the-form input type=hidden name=hidden value=something/ input class=button type=submit name=submit value=Do it now!/ input class=button cancel type=submit name=cancel value=Cancel/ /form script type=text/javascript $(function() { // VALIDATION $(#the-form).validate({ submitHandler: function(form) { $('input[name=submit]', '#the-form').attr('disabled', 'disabled'); form.submit(); } }); }); /script /body /html
[jQuery] Re: Validation
Read this documentation page on try to achieve what you want: http://docs.jquery.com/Plugins/Validation/Methods/remote On Oct 27, 1:08 pm, Ryan cowdo...@gmail.com wrote: I have seriously been fighting this issue for hours. I would appreciate some advice when someone gets a chance. I am wanting to check my database to determine if this user already exists. I thought I could just add the method to the validation. Evidently I'm doing something wrong. Here is the code. script type=text/javascript $(document).ready(function(){ var checkName = (function(value){ var dataString = '?mode=checkUserusername=' + username.val(); $.ajax({ type: GET, url: user_formsubmit.php + dataString, success: function(html){ if(html == True) { return true; } else { return false; } } }); }); $.validator.addMethod(checkName, function(value, element){ return checkName(value); }, This user name already exists.); $(#user_form).validate({ rules: { userName: { required: true, minlength: 8, checkName: false },
[jQuery] Re: validation plugin addMethod does not work for me.
Still no go... below is my code. I just want to pop a dialog to ask the user if they are sure they want to leave the company name blank. The field is not required. I thought it would be easier than this? I can't get teh addMethod to work or fire at all on validation. //validates the form var validator = frmSubmittal.validate({ debug: false, focusCleanup: false, focusInvalid: false, onfocusout: false, onkeyup: false, errorPlacement: function(error, element) {error.prependTo ( element.parents(div.ctrlHolder));}, errorElement:'div', errorClass:'valerror', rules: { restitutionaddress: {required: #sameAsBusinessAddress [checked='false']}, restitutioncity: {required: #sameAsBusinessAddress [checked='false']}, restitutionstate: {required: #sameAsBusinessAddress [checked='false']}, restitutionzipcode: {required: #sameAsBusinessAddress [checked='false']}, company:true } }); $.validator.addMethod( company, function(value, element) {alert (hello); return false;}, Enter a Company Name ); On Oct 21, 9:18 pm, Leonardo K leo...@gmail.com wrote: U need set the rules for your validation: frmSubmittal.validate({ debug: false, focusCleanup: false, focusInvalid: false, onfocusout: false, onkeyup: false, errorPlacement: function(error, element) { error.prependTo( element.parents(div.ctrlHolder)); }, errorElement:'div', errorClass:'valerror', rules:{ nameField:{ company:true } } }); On Wed, Oct 21, 2009 at 22:04, JMan jbeck...@gmail.com wrote: what am I doing wrong here? I cannot figure out how to use the addMethod(). var frmSubmittal = $(#frmSubmittal); //validates the form frmSubmittal.validate({ debug: false, focusCleanup: false, focusInvalid: false, onfocusout: false, onkeyup: false, errorPlacement: function(error, element) {error.prependTo ( element.parents(div.ctrlHolder));}, errorElement:'div', errorClass:'valerror' }); $.validator.addMethod( company, function(value, element) {alert (hello); return false;}, Enter a Company Name );
[jQuery] Re: validation plugin addMethod does not work for me.
One thing is your method name and other is your field name. If the name of your field is company and your method is company so: rules:{ company:{ company:true } } Maybe is better rename your method to not confuse. On Thu, Oct 22, 2009 at 13:24, JMan jbeck...@gmail.com wrote: Still no go... below is my code. I just want to pop a dialog to ask the user if they are sure they want to leave the company name blank. The field is not required. I thought it would be easier than this? I can't get teh addMethod to work or fire at all on validation. //validates the form var validator = frmSubmittal.validate({ debug: false, focusCleanup: false, focusInvalid: false, onfocusout: false, onkeyup: false, errorPlacement: function(error, element) {error.prependTo ( element.parents(div.ctrlHolder));}, errorElement:'div', errorClass:'valerror', rules: { restitutionaddress: {required: #sameAsBusinessAddress [checked='false']}, restitutioncity: {required: #sameAsBusinessAddress [checked='false']}, restitutionstate: {required: #sameAsBusinessAddress [checked='false']}, restitutionzipcode: {required: #sameAsBusinessAddress [checked='false']}, company:true } }); $.validator.addMethod( company, function(value, element) {alert (hello); return false;}, Enter a Company Name ); On Oct 21, 9:18 pm, Leonardo K leo...@gmail.com wrote: U need set the rules for your validation: frmSubmittal.validate({ debug: false, focusCleanup: false, focusInvalid: false, onfocusout: false, onkeyup: false, errorPlacement: function(error, element) { error.prependTo( element.parents(div.ctrlHolder)); }, errorElement:'div', errorClass:'valerror', rules:{ nameField:{ company:true } } }); On Wed, Oct 21, 2009 at 22:04, JMan jbeck...@gmail.com wrote: what am I doing wrong here? I cannot figure out how to use the addMethod(). var frmSubmittal = $(#frmSubmittal); //validates the form frmSubmittal.validate({ debug: false, focusCleanup: false, focusInvalid: false, onfocusout: false, onkeyup: false, errorPlacement: function(error, element) {error.prependTo ( element.parents(div.ctrlHolder));}, errorElement:'div', errorClass:'valerror' }); $.validator.addMethod( company, function(value, element) {alert (hello); return false;}, Enter a Company Name );
[jQuery] Re: validation plugin addMethod does not work for me.
Thanks Leonardo... I figured it out after digging through several examples. The documentation for this plugin has a huge gap in it. It shows an example of how to define a custom validator but no where does it explain how to use it. The trick being as you mentioned, defining it in the Rules or you can put the name of your custom validator in the class attribute of the field it applies to. The sad part is after hours of struggling with this it does not work as I had hoped it would. I am prompting the user for input and based on their response I would like to either cancel the form submit or allow it to continue. On Oct 22, 11:48 am, Leonardo K leo...@gmail.com wrote: One thing is your method name and other is your field name. If the name of your field is company and your method is company so: rules:{ company:{ company:true } } Maybe is better rename your method to not confuse. On Thu, Oct 22, 2009 at 13:24, JMan jbeck...@gmail.com wrote: Still no go... below is my code. I just want to pop a dialog to ask the user if they are sure they want to leave the company name blank. The field is not required. I thought it would be easier than this? I can't get teh addMethod to work or fire at all on validation. //validates the form var validator = frmSubmittal.validate({ debug: false, focusCleanup: false, focusInvalid: false, onfocusout: false, onkeyup: false, errorPlacement: function(error, element) {error.prependTo ( element.parents(div.ctrlHolder));}, errorElement:'div', errorClass:'valerror', rules: { restitutionaddress: {required: #sameAsBusinessAddress [checked='false']}, restitutioncity: {required: #sameAsBusinessAddress [checked='false']}, restitutionstate: {required: #sameAsBusinessAddress [checked='false']}, restitutionzipcode: {required: #sameAsBusinessAddress [checked='false']}, company:true } }); $.validator.addMethod( company, function(value, element) {alert (hello); return false;}, Enter a Company Name ); On Oct 21, 9:18 pm, Leonardo K leo...@gmail.com wrote: U need set the rules for your validation: frmSubmittal.validate({ debug: false, focusCleanup: false, focusInvalid: false, onfocusout: false, onkeyup: false, errorPlacement: function(error, element) { error.prependTo( element.parents(div.ctrlHolder)); }, errorElement:'div', errorClass:'valerror', rules:{ nameField:{ company:true } } }); On Wed, Oct 21, 2009 at 22:04, JMan jbeck...@gmail.com wrote: what am I doing wrong here? I cannot figure out how to use the addMethod(). var frmSubmittal = $(#frmSubmittal); //validates the form frmSubmittal.validate({ debug: false, focusCleanup: false, focusInvalid: false, onfocusout: false, onkeyup: false, errorPlacement: function(error, element) {error.prependTo ( element.parents(div.ctrlHolder));}, errorElement:'div', errorClass:'valerror' }); $.validator.addMethod( company, function(value, element) {alert (hello); return false;}, Enter a Company Name );
[jQuery] Re: validation plugin addMethod does not work for me.
U need set the rules for your validation: frmSubmittal.validate({ debug: false, focusCleanup: false, focusInvalid: false, onfocusout: false, onkeyup: false, errorPlacement: function(error, element) { error.prependTo( element.parents(div.ctrlHolder)); }, errorElement:'div', errorClass:'valerror', rules:{ nameField:{ company:true } } }); On Wed, Oct 21, 2009 at 22:04, JMan jbeck...@gmail.com wrote: what am I doing wrong here? I cannot figure out how to use the addMethod(). var frmSubmittal = $(#frmSubmittal); //validates the form frmSubmittal.validate({ debug: false, focusCleanup: false, focusInvalid: false, onfocusout: false, onkeyup: false, errorPlacement: function(error, element) {error.prependTo ( element.parents(div.ctrlHolder));}, errorElement:'div', errorClass:'valerror' }); $.validator.addMethod( company, function(value, element) {alert (hello); return false;}, Enter a Company Name );
[jQuery] Re: validation: preprocessing form fields ?
apparenty not :-) just for the record - i'm doing things like this: code jQuery.validator.addMethod( lowercase, function(value, element) { jQuery(element).val(value.toLowerCase()); return true; }, ) /code which i can then apply in validation like code var validator = $(#myform).validate({ rules: { myfield: lowercase } }) /code clearly, thats not really validation, but the issue is it needs to be executed right before other validation, at the same moments interfacewise ... $2c, *-pike
[jQuery] Re: Validation plugin: textarea to allow only digits, but allowing linebreaks?
You can create your own validate method: http://docs.jquery.com/Plugins/Validation/Validator/addMethod#namemethodmessage jQuery.validator.addMethod(digitsAndLineBreak, function(value, element) { return /^[\d|\n]+$/.test(value); }, Please enter only digits); then: $(#quicksend_form).validate({ rules: { recepients: { required: true, digitsAndLineBreak: true, minlength: 10 } } }); On Thu, Oct 15, 2009 at 15:57, Renie renie.ra...@gmail.com wrote: I'm using the Jquery Validation Plugin on my site, and I have a textfield that validates to only allow numbers. However, that also doesn't allow linebreaks - which I need to have! Is there a way around this? Here's the working code: html head script src=http://code.jquery.com/jquery-latest.js;/script script type=text/javascript src=http://dev.jquery.com/view/trunk/ plugins/validate/jquery.validate.jshttp://dev.jquery.com/view/trunk/%0Aplugins/validate/jquery.validate.js /script script $(document).ready(function() { // Doc Ready Functions $(#quicksend_form).validate({ rules: { recepients: { required: true, digits: true, minlength: 10 } } }); }); // Doc Ready Functions /script /head body form action=# method=post enctype=multipart/form-data name=quicksend_form id=quicksend_form textarea name=recepients id=recepients rows=20/textarea input type=submit name=button id=button value=Submit / /form /body /html
[jQuery] Re: Validation: Form with multiple submit buttons having different validation rules
I have seen the login form example (http://jquery.bassistance.de/ validate/demo/login/), but I cannot use it as I have to manually change css classes for all required elements. Can someone help me out in this issue? Should I write custom methods for this? On Oct 2, 10:14 pm, NovoGeek kris.techg...@gmail.com wrote: Hi all, I tried searching for similar issues but couldn't find a satisfying answer. So posting it here. I have a form with multiple fieldsets which are visible conditionally. There are three submit buttons Abandon, Save and Save Continue. Each button should validate specific controls of the form and submit it. I tried setting onsubmit: false and checking for $('#myForm').valid () on click of these buttons., but that validates all controls of the form. Can someone suggest me what I should do?
[jQuery] Re: Validation help needed
You should not be calling submit() first. You only call it after everything is validated. This can be as easy as a if-statement. Here's a simple example. Modify it to work with your scenrio. $(function() { $('#testForm').bind('submit', function() { $(this).validate(validation_options); var valid = $(this).valid(); if (valid) { // do your ajax } }); }); var validation_options = { // set your options here }; On Oct 2, 9:13 am, coachz bringmewa...@gmail.com wrote: when i run this.submit(); i submit my ajax request, so how can i get the validate to fire on invalidHandler and submitHandler so I will only run this.submit(); when it passes validation ? Currently the validator does not validate the form at all on submit, I need it to cancel the submit if there are validation issues and submit if there are none. function submitForm(form) { this.submit(); $(#frmAddTask).validate({ errorPlacement: function(error, element) { error.insertAfter (element); }, invalidHandler: function(form, validator) { alert(validation failed); }, submitHandler: function(form, validator) { alert(validation passed); }, rules: { title: { required: true, minlength: 5 } } }); } // Build Add a New Task pop up dialog // Instantiate the Add a New Task pop up dialog YAHOO.util.Dom.removeClass('dlgAddTask', 'hideForm'); YAHOO.techdocs.dlgAddTask = new YAHOO.widget.Dialog(dlgAddTask, { width : 50em, height: 32em, fixedcenter : true, visible : false, constraintoviewport : true, close: false, buttons : [ { text:Submit, handler:submitForm, isDefault:true }, { text:Cancel, handler:function() {this.cancel();} } ] });
[jQuery] Re: (validation) removal of error message problem
i can't reproduce on a test page. I updated to 1.5.5, but no change. the page in question is dynamically generated using AJAX data calls. i can see the error label in the js console: $(label.error).length 1 $(label.error).toHtml() LABEL class=error for=orders[4].elements[2].Value generated=trueOnly numeric values are permitted./LABEL but the 'for' attribute selector in the errorsFor method doesn't work. it doesn't work from the console either: $(label([for='orders[4].elements[2].Value'])).length 0 On Sep 22, 4:48 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Please update to 1.5.5 - also, please provide a testpage, otherwise I can't help. Jörn On Tue, Sep 22, 2009 at 11:08 PM, chief7 chi...@gmail.com wrote: fyi - using jquery.validate.js version 1.5.2 On Sep 22, 3:39 pm, chief7 chi...@gmail.com wrote: looks like this issue is caused by the name of the input. the name is orders[5].elements[2].Value which an attribute selector won't find (ie. $(input[for=orders[5].elements[2].Value])), but if the name is elements[2].Value it works fine. the 'for' attribute selector is used on line 630 of jquery.validate.js On Sep 22, 7:32 am, chief7 chi...@gmail.com wrote: the validation error message isn't removed/hidden after i fix an invalid input. If I make the input invalid again another error message is appended below the first error message. error messages are added/removed appropriately on all other pages. this problem is only occurring on one page.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: (validation) removal of error message problem
Try this: $(label[for='orders[4].elements[2].Value']).length On Wed, Sep 23, 2009 at 3:17 PM, chief7 chi...@gmail.com wrote: i can't reproduce on a test page. I updated to 1.5.5, but no change. the page in question is dynamically generated using AJAX data calls. i can see the error label in the js console: $(label.error).length 1 $(label.error).toHtml() LABEL class=error for=orders[4].elements[2].Value generated=trueOnly numeric values are permitted./LABEL but the 'for' attribute selector in the errorsFor method doesn't work. it doesn't work from the console either: $(label([for='orders[4].elements[2].Value'])).length 0 On Sep 22, 4:48 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Please update to 1.5.5 - also, please provide a testpage, otherwise I can't help. Jörn On Tue, Sep 22, 2009 at 11:08 PM, chief7 chi...@gmail.com wrote: fyi - using jquery.validate.js version 1.5.2 On Sep 22, 3:39 pm, chief7 chi...@gmail.com wrote: looks like this issue is caused by the name of the input. the name is orders[5].elements[2].Value which an attribute selector won't find (ie. $(input[for=orders[5].elements[2].Value])), but if the name is elements[2].Value it works fine. the 'for' attribute selector is used on line 630 of jquery.validate.js On Sep 22, 7:32 am, chief7 chi...@gmail.com wrote: the validation error message isn't removed/hidden after i fix an invalid input. If I make the input invalid again another error message is appended below the first error message. error messages are added/removed appropriately on all other pages. this problem is only occurring on one page.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: (validation) removal of error message problem
This is an issue in IE7, IE8, FF3 and Chrome 3. On Sep 23, 8:17 am, chief7 chi...@gmail.com wrote: i can't reproduce on a test page. I updated to 1.5.5, but no change. the page in question is dynamically generated using AJAX data calls. i can see the error label in the js console: $(label.error).length 1 $(label.error).toHtml() LABEL class=error for=orders[4].elements[2].Value generated=trueOnly numeric values are permitted./LABEL but the 'for' attribute selector in the errorsFor method doesn't work. it doesn't work from the console either: $(label([for='orders[4].elements[2].Value'])).length 0 On Sep 22, 4:48 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Please update to 1.5.5 - also, please provide a testpage, otherwise I can't help. Jörn On Tue, Sep 22, 2009 at 11:08 PM, chief7 chi...@gmail.com wrote: fyi - using jquery.validate.js version 1.5.2 On Sep 22, 3:39 pm, chief7 chi...@gmail.com wrote: looks like this issue is caused by the name of the input. the name is orders[5].elements[2].Value which an attribute selector won't find (ie. $(input[for=orders[5].elements[2].Value])), but if the name is elements[2].Value it works fine. the 'for' attribute selector is used on line 630 of jquery.validate.js On Sep 22, 7:32 am, chief7 chi...@gmail.com wrote: the validation error message isn't removed/hidden after i fix an invalid input. If I make the input invalid again another error message is appended below the first error message. error messages are added/removed appropriately on all other pages. this problem is only occurring on one page.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: (validation) removal of error message problem
Still 0. On Sep 23, 8:20 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Try this: $(label[for='orders[4].elements[2].Value']).length On Wed, Sep 23, 2009 at 3:17 PM, chief7 chi...@gmail.com wrote: i can't reproduce on a test page. I updated to 1.5.5, but no change. the page in question is dynamically generated using AJAX data calls. i can see the error label in the js console: $(label.error).length 1 $(label.error).toHtml() LABEL class=error for=orders[4].elements[2].Value generated=trueOnly numeric values are permitted./LABEL but the 'for' attribute selector in the errorsFor method doesn't work. it doesn't work from the console either: $(label([for='orders[4].elements[2].Value'])).length 0 On Sep 22, 4:48 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Please update to 1.5.5 - also, please provide a testpage, otherwise I can't help. Jörn On Tue, Sep 22, 2009 at 11:08 PM, chief7 chi...@gmail.com wrote: fyi - using jquery.validate.js version 1.5.2 On Sep 22, 3:39 pm, chief7 chi...@gmail.com wrote: looks like this issue is caused by the name of the input. the name is orders[5].elements[2].Value which an attribute selector won't find (ie. $(input[for=orders[5].elements[2].Value])), but if the name is elements[2].Value it works fine. the 'for' attribute selector is used on line 630 of jquery.validate.js On Sep 22, 7:32 am, chief7 chi...@gmail.com wrote: the validation error message isn't removed/hidden after i fix an invalid input. If I make the input invalid again another error message is appended below the first error message. error messages are added/removed appropriately on all other pages. this problem is only occurring on one page.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: (validation) removal of error message problem
I created a test page - http://pastie.org/627543 steps to reproduce: -open the page in a browser -add a letter to one of the amount inputs -click on another input -the validation should show -go back to the same input and remove the letter you added -the error should be hidden but its not On Sep 23, 8:29 am, chief7 chi...@gmail.com wrote: Still 0. On Sep 23, 8:20 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Try this: $(label[for='orders[4].elements[2].Value']).length On Wed, Sep 23, 2009 at 3:17 PM, chief7 chi...@gmail.com wrote: i can't reproduce on a test page. I updated to 1.5.5, but no change. the page in question is dynamically generated using AJAX data calls. i can see the error label in the js console: $(label.error).length 1 $(label.error).toHtml() LABEL class=error for=orders[4].elements[2].Value generated=trueOnly numeric values are permitted./LABEL but the 'for' attribute selector in the errorsFor method doesn't work. it doesn't work from the console either: $(label([for='orders[4].elements[2].Value'])).length 0 On Sep 22, 4:48 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Please update to 1.5.5 - also, please provide a testpage, otherwise I can't help. Jörn On Tue, Sep 22, 2009 at 11:08 PM, chief7 chi...@gmail.com wrote: fyi - using jquery.validate.js version 1.5.2 On Sep 22, 3:39 pm, chief7 chi...@gmail.com wrote: looks like this issue is caused by the name of the input. the name is orders[5].elements[2].Value which an attribute selector won't find (ie. $(input[for=orders[5].elements[2].Value])), but if the name is elements[2].Value it works fine. the 'for' attribute selector is used on line 630 of jquery.validate.js On Sep 22, 7:32 am, chief7 chi...@gmail.com wrote: the validation error message isn't removed/hidden after i fix an invalid input. If I make the input invalid again another error message is appended below the first error message. error messages are added/removed appropriately on all other pages. this problem is only occurring on one page.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: (validation) removal of error message problem
Cleaned up the test page: http://pastie.org/627561 On Sep 23, 10:35 am, chief7 chi...@gmail.com wrote: I created a test page -http://pastie.org/627543 steps to reproduce: -open the page in a browser -add a letter to one of the amount inputs -click on another input -the validation should show -go back to the same input and remove the letter you added -the error should be hidden but its not On Sep 23, 8:29 am, chief7 chi...@gmail.com wrote: Still 0. On Sep 23, 8:20 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Try this: $(label[for='orders[4].elements[2].Value']).length On Wed, Sep 23, 2009 at 3:17 PM, chief7 chi...@gmail.com wrote: i can't reproduce on a test page. I updated to 1.5.5, but no change. the page in question is dynamically generated using AJAX data calls. i can see the error label in the js console: $(label.error).length 1 $(label.error).toHtml() LABEL class=error for=orders[4].elements[2].Value generated=trueOnly numeric values are permitted./LABEL but the 'for' attribute selector in the errorsFor method doesn't work. it doesn't work from the console either: $(label([for='orders[4].elements[2].Value'])).length 0 On Sep 22, 4:48 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Please update to 1.5.5 - also, please provide a testpage, otherwise I can't help. Jörn On Tue, Sep 22, 2009 at 11:08 PM, chief7 chi...@gmail.com wrote: fyi - using jquery.validate.js version 1.5.2 On Sep 22, 3:39 pm, chief7 chi...@gmail.com wrote: looks like this issue is caused by the name of the input. the name is orders[5].elements[2].Value which an attribute selector won't find (ie. $(input[for=orders[5].elements[2].Value])), but if the name is elements[2].Value it works fine. the 'for' attribute selector is used on line 630 of jquery.validate.js On Sep 22, 7:32 am, chief7 chi...@gmail.com wrote: the validation error message isn't removed/hidden after i fix an invalid input. If I make the input invalid again another error message is appended below the first error message. error messages are added/removed appropriately on all other pages. this problem is only occurring on one page.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: (validation) removal of error message problem
looks like this issue is caused by the name of the input. the name is orders[5].elements[2].Value which an attribute selector won't find (ie. $(input[for=orders[5].elements[2].Value])), but if the name is elements[2].Value it works fine. the 'for' attribute selector is used on line 630 of jquery.validate.js On Sep 22, 7:32 am, chief7 chi...@gmail.com wrote: the validation error message isn't removed/hidden after i fix an invalid input. If I make the input invalid again another error message is appended below the first error message. error messages are added/removed appropriately on all other pages. this problem is only occurring on one page.
[jQuery] Re: (validation) removal of error message problem
fyi - using jquery.validate.js version 1.5.2 On Sep 22, 3:39 pm, chief7 chi...@gmail.com wrote: looks like this issue is caused by the name of the input. the name is orders[5].elements[2].Value which an attribute selector won't find (ie. $(input[for=orders[5].elements[2].Value])), but if the name is elements[2].Value it works fine. the 'for' attribute selector is used on line 630 of jquery.validate.js On Sep 22, 7:32 am, chief7 chi...@gmail.com wrote: the validation error message isn't removed/hidden after i fix an invalid input. If I make the input invalid again another error message is appended below the first error message. error messages are added/removed appropriately on all other pages. this problem is only occurring on one page.- Hide quoted text - - Show quoted text -
[jQuery] Re: (validation) removal of error message problem
Please update to 1.5.5 - also, please provide a testpage, otherwise I can't help. Jörn On Tue, Sep 22, 2009 at 11:08 PM, chief7 chi...@gmail.com wrote: fyi - using jquery.validate.js version 1.5.2 On Sep 22, 3:39 pm, chief7 chi...@gmail.com wrote: looks like this issue is caused by the name of the input. the name is orders[5].elements[2].Value which an attribute selector won't find (ie. $(input[for=orders[5].elements[2].Value])), but if the name is elements[2].Value it works fine. the 'for' attribute selector is used on line 630 of jquery.validate.js On Sep 22, 7:32 am, chief7 chi...@gmail.com wrote: the validation error message isn't removed/hidden after i fix an invalid input. If I make the input invalid again another error message is appended below the first error message. error messages are added/removed appropriately on all other pages. this problem is only occurring on one page.- Hide quoted text - - Show quoted text -
[jQuery] Re: Validation, ignore specific words
You can avoid that issue by using a solution that doesn't modify the inputs value. The (planned) jQuery UI watermark widget does that, you can get the code from labs here: http://jquery-ui.googlecode.com/svn/branches/labs/watermark/ui/ui.watermark.js A sort-of demo is here: http://www.commadot.com/jquery/experiments/shunra/ More details on the widget here: http://wiki.jqueryui.com/Watermark Jörn On Sat, Sep 19, 2009 at 6:44 AM, jbotos m...@jbotos.com wrote: Hi, I have values in each input which tells the user what to enter in that field. Each value clears on click and resets to default if no value is entered. How can I have it treat my values as if it would be empty (no value entered)?
[jQuery] Re: validation: how do I make sure a radio button is picked?
Perhaps I am misunderstanding something in your requirements, but with the validation plugin (link below), it is as simple as adding class=required to the input tag. http://docs.jquery.com/Plugins/Validation HTH
[jQuery] Re: validation: how do I make sure a radio button is picked?
On Sep 3, 6:17 am, Matt Wilson m...@tplus1.com wrote: I have a list of radio buttons, all with the same name, and each has a different value. I want a validator that tests if one is picked. How do I do this? Set one as checked by default (as suggested by the W3C HTML specification), no script or validation needed. -- Rob
[jQuery] Re: Validation question
only perform the post if the error message div isnt there, or has no text in it if( !($('#divSteps3')==undefined) $('div.error-message').text ().length0) ) something like that On Aug 31, 1:53 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have this script $(document).ready( function() { $('#username').blur( function () { fieldName = $(this).attr('id'); fieldValue = $(this).val(); $.post('/users/ajax_validate', { field: fieldName, value: fieldValue }, function(error) { if(error.length != 0) { $('#username').after('div class=error-message id='+ fieldName +'-exists' + error + '/div'); } else { $('#' + fieldName + '-exists').remove(); } }); }); }); Which sends a requet to determine if the username is taken...pretty simple if so it displays Please choose another message. My problem is if the user goes back to the field and then leaves without changing it it sends the request again and then shows Please choose another name Please choose another name How can I modify the script so if there is an error and not fixed to leave the message and not repeat it? Dave
[jQuery] Re: Validation question
whoops! instead of '#divSteps3' i meant 'div.error-message' next time i should proofread On Aug 31, 3:34 pm, #micah micah.a.sm...@gmail.com wrote: only perform the post if the error message div isnt there, or has no text in it if( !($('#divSteps3')==undefined) $('div.error-message').text ().length0) ) something like that On Aug 31, 1:53 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have this script $(document).ready( function() { $('#username').blur( function () { fieldName = $(this).attr('id'); fieldValue = $(this).val(); $.post('/users/ajax_validate', { field: fieldName, value: fieldValue }, function(error) { if(error.length != 0) { $('#username').after('div class=error-message id='+ fieldName +'-exists' + error + '/div'); } else { $('#' + fieldName + '-exists').remove(); } }); }); }); Which sends a requet to determine if the username is taken...pretty simple if so it displays Please choose another message. My problem is if the user goes back to the field and then leaves without changing it it sends the request again and then shows Please choose another name Please choose another name How can I modify the script so if there is an error and not fixed to leave the message and not repeat it? Dave
[jQuery] Re: (Validation) Problem with All or Nothing fields
Can anyone help with this, Please? Thanks.
[jQuery] Re: (Validation) How to use with Multi-Select?
Here are examples with multi-selects: http://jquery.bassistance.de/validate/demo/radio-checkbox-select-demo.html Jörn On Thu, Aug 27, 2009 at 3:04 PM, Psyclom...@datamodel.org wrote: I have a form with a multi-select field that needs to be validated, so at least one option is selected. Is there a setting I'm missing in the validation plug-in? Thanks in advance.
[jQuery] Re: (Validation) How to use with Multi-Select?
Thanks for responding so quickly. Unfortunately, my form just isn't working like yours. I don't see what I've done wrong. Maybe you can see something? Here is the code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http:// www.w3.org/TR/html4/loose.dtd html head script type=text/javascript src=/jquery/jquery-1.3.2.min.js/ script script type=text/javascript src=/jquery/jquery.validate.js/ script form name=brief id=briefform enctype=multipart/form-data action=/amstest/edit.php method=POST select name=ROLE_1 id=ROLE_1 validate=required:true, minlength:1 multiple=multiple title=Please specify at least one person size=5 option value=''Select a person option value=1First Person option value=2Second Person option value=3Third Person /select input type=submit value=Validate Selecttests/ /form script language=JavaScript type=text/javascript $.validator.addClassRules({ multirequired: { required: true, minlength: 1 } }); $.validator.addMethod(allOrNothing, function(value, element) { var i, sply, prod, prog, amt, allthere; allthere = new Array(); for (i=0; document.getElementById('SPLY_'+i)!=null; i++) { allthere[i] = -1; sply = document.getElementById('SPLY_'+i).value; prod = document.getElementById('prod_'+i).value; prog = document.getElementById('prog_'+i).value; amt = document.getElementById('amt_'+i).value; if (sply0 || prod0 || prog0 || amt.length0) allthere[i] = (sply0 prod0 prog0 amt.length0); } return (element.id=='amt0'?element.length0:element.value0) || allthere[0]; }, brData Missing); $.validator.addClassRules({ allOrNothing: { allOrNothing: true } }); form = $(#briefform) form.validate({ debug: true, success: valid, submitHandler: function() { alert(Submitted!) }, errorPlacement: function(error, element) { tid = element.attr(id); for (i=0; document.getElementById('SPLY_'+i)!=null; i++) if (tid == SPLY_+i || tid == prod_+i || tid == prog_+i || tid == amt_+i) error.insertAfter(#DESC_+i); else error.insertAfter(element); }, errorClass: errormsg }); /script /body /html On Aug 27, 8:09 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Here are examples with multi-selects:http://jquery.bassistance.de/validate/demo/radio-checkbox-select-demo... Jörn On Thu, Aug 27, 2009 at 3:04 PM, Psyclom...@datamodel.org wrote: I have a form with a multi-select field that needs to be validated, so at least one option is selected. Is there a setting I'm missing in the validation plug-in? Thanks in advance.- Hide quoted text - - Show quoted text -
[jQuery] Re: validation - multiple errorPlacements
I did not understand this Jörn Zaefferer wrote: seedy schrieb: Is it possible to use errorPlacement with the validation plugin to have a different placement for each field validated? ie. $('#testForm').validate({ rules:{ firstname:{required:true}, integer:{required:true} } }) I would like to have the error for firstname appended to $('#div1') , and errors for integer before $('#div2') You can use the errorPlacement option for that. Its far from perfect, but allows you to do every placement you can think of. One example of the usage of errorPlacement can be found here: http://dev.jquery.com/view/trunk/plugins/validate/demo-test/milk/ The interesting part: |// the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { if ( element.is(:radio) ) error.appendTo( element.parent().next().next() ); else if ( element.is(:checkbox) ) error.appendTo ( element.next() ); else error.appendTo( element.parent().next() ); }, | -- Jörn -- View this message in context: http://www.nabble.com/validation---multiple-errorPlacements-tp12781506s27240p24938662.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Validation Error message help
Check the error message existence before adding a new error msg if ($('#'+fieldName+'-exists').length = 0) $('#username').after('div class=error-messageid='+ fieldName +'- exists' + error + '/div'); On Aug 12, 2:17 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have this script: $(document).ready( function() { $('#username').blur( function () { fieldName = $(this).attr('id'); fieldValue = $(this).val(); $.post('/users/ajax_validate', { field: fieldName, value: fieldValue }, function(error) { if(error.length != 0) { $('#username').after('div class=error-message id='+ fieldName +'-exists' + error + '/div'); } else { $('#' + fieldName + '-exists').remove(); } }); }); }); So when the user leaves the field it checks validation. If error it shows an error message. Everything is working fine except if the user goes back to the field where there was an error and does not chnge anything and leaves the field again the error message is duplicated. So they enter a username peter it says Please choose a different name if they go back to the username and thenleavewith out changing peter i now have: Please choose a different name Please choose a different name What do I have to change / add so that only 1 message will appear? Thanks Dave
[jQuery] Re: VALIDATION not validating when submit button clicked....
Please show the rest of your code. Jörn On Mon, Aug 10, 2009 at 11:49 PM, Miket3miketro...@gmail.com wrote: Here is my handler: submitHandler: function(form) { alert('I CANT GET THIS TO TRIGGER'); }, Here is my button: input class=submit type=submit id=register value=Register How do i trigger a validate when the submit button is clicked? All of my validations work while I am working with the form but the button does zilch.
[jQuery] Re: VALIDATION not validating when submit button clicked....
Here it is minus the submit handler var v = $(#myform).validate({ rules: { username: {required: true, minlength: 4, remote: {url:lookup.php, type : post, data: {table:members, failmsg:true, successmsg:false, key:username, value:function(){return $(#username).val (); } } } }, password: {required: true, minlength: 5 }, email: {required: true, email: true }, zipcode: {required: true, minlength: 5 }, phone: { phoneUS: true }, cellphone: { phoneUS: true }, fax: { phoneUS: true }, }, //end of rules messages: { username: { required: brEnter a username, minlength: jQuery.format(brEnter at least {0} characters), remote : jQuery.format(brSorry... {0} is already taken.), }, password: { required: Provide a password, rangelength: jQuery.format(Enter at least {0} characters) }, email: { required: Please enter a valid email address, minlength: Please enter a valid email address } }, //end of messages // the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { if ( element.is(:radio) ) error.appendTo( element.parent().next().next() ); else if ( element.is(:checkbox) ) error.appendTo ( element.next() ); else error.appendTo( element.parent() ); }, //end of errorPlacement // set this class to error-labels to indicate valid fields success: function(label) { var valid_img = 'img src=/global_libs/images/icons/ checked.gif'; // set nbsp; as text for IE label.html(valid_img); } // end of success }); On Aug 10, 6:12 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Please show the rest of your code. Jörn On Mon, Aug 10, 2009 at 11:49 PM, Miket3miketro...@gmail.com wrote: Here is my handler: submitHandler: function(form) { alert('I CANT GET THIS TO TRIGGER'); }, Here is my button: input class=submit type=submit id=register value=Register How do i trigger a validate when the submit button is clicked? All of my validations work while I am working with the form but the button does zilch.
[jQuery] Re: VALIDATION not validating when submit button clicked....
DO NOT include hidden fields in the plugin data. I had 3 hidden fields that weren't required but they were phoneUS. That must be a no no. I havent thought about the logic behind... but I am moving on to the next problem. and it may have been that i had no messages setup for them. only rules. On Aug 10, 6:56 pm, Miket3 miketro...@gmail.com wrote: Here it is minus the submit handler var v = $(#myform).validate({ rules: { username: {required: true, minlength: 4, remote: {url:lookup.php, type : post, data: {table:members, failmsg:true, successmsg:false, key:username, value:function(){return $(#username).val (); } } } }, password: {required: true, minlength: 5 }, email: {required: true, email: true }, zipcode: {required: true, minlength: 5 }, phone: { phoneUS: true }, cellphone: { phoneUS: true }, fax: { phoneUS: true }, }, //end of rules messages: { username: { required: brEnter a username, minlength: jQuery.format(brEnter at least {0} characters), remote : jQuery.format(brSorry... {0} is already taken.), }, password: { required: Provide a password, rangelength: jQuery.format(Enter at least {0} characters) }, email: { required: Please enter a valid email address, minlength: Please enter a valid email address } }, //end of messages // the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { if ( element.is(:radio) ) error.appendTo( element.parent().next().next() ); else if ( element.is(:checkbox) ) error.appendTo ( element.next() ); else error.appendTo( element.parent() ); }, //end of errorPlacement // set this class to error-labels to indicate valid fields success: function(label) { var valid_img = 'img src=/global_libs/images/icons/ checked.gif'; // set nbsp; as text for IE label.html(valid_img); } // end of success }); On Aug 10, 6:12 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Please show the rest of your code. Jörn On Mon, Aug 10, 2009 at 11:49 PM, Miket3miketro...@gmail.com wrote: Here is my handler: submitHandler: function(form) { alert('I CANT GET THIS TO TRIGGER'); }, Here is my button: input class=submit type=submit id=register value=Register How do i trigger a validate when the submit button is clicked? All of my validations work while I am working with the form but the button does zilch.
[jQuery] Re: Validation with rewriting
You could start by writing custom methods for each of these input types, and where possible, delegate to the existing methods: http://docs.jquery.com/Plugins/Validation/Validator/addMethod What do you think? Jörn On Mon, Jul 27, 2009 at 8:42 PM, Brett Ritterswift...@swiftone.org wrote: I considering input rewriting (transformation, conversion, etc, use the verb of your choice) to be an essential part of validation. This means phone numbers, SSN, dates, credit card numbers, etc should all accept loose input types and should be standardized for backend processing. (Personal Pet Peeve - sites that instruct you not to use spaces or hyphens in credit card numbers) This article makes the general case: http://www.hising.net/2007/03/30/form-validation-with-javascript/ The article for the popular validation plugin notes the above article, but doesn't offer code for this particular point (See #6): http://bassistance.de/2007/07/04/about-client-side-form-validation-and-frameworks/ It does point out the masked input plugin, but my goal is not to provide hints to the user on how to take additional effort but rather to save them effort in the first place. Both of these articles date from 2 years ago. Googling for existing plugins has not led me to happiness. I'll happily write my own plugin if it is not reinventing the wheel, but I'd love to have some compatibility with the validate plugin. Does anyone have suggestions for the best approach for doing so? The transformation can be done front-end (i.e. visible to the user, changing the value in the inputs) or internally (standardizing the values sent to the validate plugin), I'm not picky as to which just yet. -- Brett Ritter / SwiftOne swift...@swiftone.org
[jQuery] Re: Validation with rewriting
On Mon, Jul 27, 2009 at 5:20 PM, Jörn Zaeffererjoern.zaeffe...@googlemail.com wrote: You could start by writing custom methods for each of these input types, and where possible, delegate to the existing methods: http://docs.jquery.com/Plugins/Validation/Validator/addMethod If I'm following you, you're saying to have validation that accepts the loose input and considers them all valid. That doesn't help me sanitize for the backend though. On submission, that Phone number should come across as the proper format. This also complicates the validation methods considerably. Or am I misunderstanding you? -- Brett Ritter / SwiftOne swift...@swiftone.org
[jQuery] Re: Validation with rewriting
Having JS sanitize for the backend is somewhat dubious, I'd not go there, but you probably don't want to discuss that. Anyway, a validation method has access to the validate element, so you could as well write a method that just sanitizes, nothing else. Combine that with a strict validation method, ala: rules: { ssnfield: { required: true ssncleaner: true, ssn: ssn } } No change to required needed. ssncleaner would always return true, and change the input value; ssn would just validate a strict ssn. A very simple and general sanitizer would just trim whitespace - the plugin did that in earlier versions, but that wasn't desired in general: $.validator.addMethod(trim, function(value, element) { element.value = $.trim(value); return true; }); That seems to be quite flexible to me. Jörn On Mon, Jul 27, 2009 at 11:28 PM, Brett Ritterswift...@swiftone.org wrote: On Mon, Jul 27, 2009 at 5:20 PM, Jörn Zaeffererjoern.zaeffe...@googlemail.com wrote: You could start by writing custom methods for each of these input types, and where possible, delegate to the existing methods: http://docs.jquery.com/Plugins/Validation/Validator/addMethod If I'm following you, you're saying to have validation that accepts the loose input and considers them all valid. That doesn't help me sanitize for the backend though. On submission, that Phone number should come across as the proper format. This also complicates the validation methods considerably. Or am I misunderstanding you? -- Brett Ritter / SwiftOne swift...@swiftone.org
[jQuery] Re: Validation with rewriting
On Mon, Jul 27, 2009 at 6:06 PM, Jörn Zaeffererjoern.zaeffe...@googlemail.com wrote: Having JS sanitize for the backend is somewhat dubious, I'd not go there, but you probably don't want to discuss that. I think we're in agreement there, actually. JS provides no security and shouldn't be relied on. Rather I'm looking at a progressive enhancement feature: Server-side validation can reject (for example) any CC Number that isn't 16 digits. User's w/o JS can get the functional basics (please enter your CC number without hyphens or spaces) The JS front end will accept multiple formats (16 digits, 4 sets of 4 digits with whitespace, etc) and translate them to what the server demands. This is more impressive with string inputs for dates, phone numbers, etc. Typing 8005551212 is easy on the user, and seeing (800) 555-1212 is better for their visual parsing. Anyway, a validation method has access to the validate element, so you Ah, this is the essential piece I was missing. I'll code a few tests and report back in a few days. Thanks for the help! -- Brett Ritter / SwiftOne swift...@swiftone.org
[jQuery] Re: Validation plugin 1.5.5 error in IE6
I found this link: http://return-true.com/2008/12/fixing-jquery-validator-plugin-in-internet-explorer-6/ Looks like it's a character set issue. -Mario On Jun 29, 4:21 pm, Tristan teastb...@gmail.com wrote: The jquery.validate.pack.js file found onhttp://bassistance.de/jquery-plugins/jquery-plugin-validation/causes an error when run in IE6.
[jQuery] Re: Validation plugin 1.5.5 error in IE6
It would be great if you could post your repacked version for us. Thanks! -Mario
[jQuery] Re: Validation plugin - submit form without validation
Try $(#frm)[0].submit() On Jul 20, 1:56 pm, Adam P aploc...@gmail.com wrote: I'm using the Validation plugin for JQuery and was wondering if there was a function to submit the form without causing it to validate the form. I have a table with a list of radio-buttons and above that is a drop down list of states. The drop down list of states is used to filter the table rows and when the selected item changes it posts-back to the server (via $(#frm).submit()). I don't want this to cause any validation to occur. Is there another function I can call besides submit(), or some other method? Thanks
[jQuery] Re: (Validation) How to submit a form without validating
You can add a class=cancel to that button B. The plugin will then skip the validation. Jörn On Thu, Jul 16, 2009 at 9:05 AM, mnaveedmnaveed...@gmail.com wrote: Hi, I am using the Jquery validationss plugin for my form validations. Now I have a situation where I have two submit buttons in a single form (say button A and button B). For button A, I want to run validations but for button B I don't want to run the validations and submit the form without validating.. How can i do this? Thanks.
[jQuery] Re: (Validation) How to submit a form without validating
Thanks Jörn , this is exactly what I need. On Jul 16, 12:57 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You can add a class=cancel to that button B. The plugin will then skip the validation. Jörn On Thu, Jul 16, 2009 at 9:05 AM, mnaveedmnaveed...@gmail.com wrote: Hi, I am using the Jquery validationss plugin for my form validations. Now I have a situation where I have two submit buttons in a single form (say button A and button B). For button A, I want to run validations but for button B I don't want to run the validations and submit the form without validating.. How can i do this? Thanks.
[jQuery] Re: validation plugin's date method doesn't like mm-dd-yyyy formatted dates
The default date validation is quite weak, indeed. You can add your own method, maybe using datejs.com, easily: http://docs.jquery.com/Plugins/Validation/Validator/addMethod Jörn On Tue, Jul 14, 2009 at 10:47 PM, Matt Wilsonm...@tplus1.com wrote: I'm using this validation plugin http://bassistance.de/jquery-plugins/jquery-plugin-validation/ and it is great. However, it rejects dates like 07-14-2009 as invalid. Is there some way to add a list of valid formats? If not, should I write my own method to match that particlar format?
[jQuery] Re: (Validation) how to add validation on a select box with auto post
is it difficult?$(#State).val() 2009/7/13 mnaveed mnaveed...@gmail.com Hi, I have a select box with and onchange event to get the data from serever, SELECT name=States id=Stateonchange=getData(this.value) Now i want to validate that if no value is selected from the above list, then it should not send the ajax request. How can i apply the Jquery validation plugin here? Thanks.
[jQuery] Re: (Validation) how to add validation on a select box with auto post
I am using the JQuery Validation plug in to validate my form. How can i do this with that? On Jul 13, 1:34 pm, 刘永杰 liuyongjie...@gmail.com wrote: is it difficult?$(#State).val() 2009/7/13 mnaveed mnaveed...@gmail.com Hi, I have a select box with and onchange event to get the data from serever, SELECT name=States id=State onchange=getData(this.value) Now i want to validate that if no value is selected from the above list, then it should not send the ajax request. How can i apply the Jquery validation plugin here? Thanks.
[jQuery] Re: (Validation) how to add validation on a select box with auto post
sorry!i didn't use JQuery Validation plug in. 2009/7/13 mnaveed mnaveed...@gmail.com I am using the JQuery Validation plug in to validate my form. How can i do this with that? On Jul 13, 1:34 pm, 刘永杰 liuyongjie...@gmail.com wrote: is it difficult?$(#State).val() 2009/7/13 mnaveed mnaveed...@gmail.com Hi, I have a select box with and onchange event to get the data from serever, SELECT name=States id=Stateonchange=getData(this.value) Now i want to validate that if no value is selected from the above list, then it should not send the ajax request. How can i apply the Jquery validation plugin here? Thanks.
[jQuery] Re: (Validation) how to add validation on a select box with auto post
what you should do is take the onchange event out of the html and put it into a document ready like this $(document).ready(function(){ $(#State).change(function() { //check to see if the feild has a value if ($(this).val() != ){ //ok lets get the data then getData(($this).val()) } }); }); I think this is what you wanted to test for Mean Mike On Jul 13, 4:22 am, mnaveed mnaveed...@gmail.com wrote: Hi, I have a select box with and onchange event to get the data from serever, SELECT name=States id=State onchange=getData(this.value) Now i want to validate that if no value is selected from the above list, then it should not send the ajax request. How can i apply the Jquery validation plugin here? Thanks.
[jQuery] Re: [validation] how to return for jquery.Format
how i can use variables to build the url? On Sat, Jul 4, 2009 at 12:08 PM, Jörn Zaeffererjoern.zaeffe...@googlemail.com wrote: Use the remote method: http://docs.jquery.com/Plugins/Validation/Methods/remote#url Jörn On Sat, Jul 4, 2009 at 6:30 PM, Manolet Gmailmano...@gmail.com wrote: Hi, im adding a method. i want to display a message like: THECONTENTOFMYINPUT is already user. this is what im doing. jQuery.validator.addMethod(checkname, function(value, element) { var name = $('#PromotionName').val(); var promotion_id = $('#PromotionId').val(); text = $.ajax({ url: /promotions/checkName/+name+'/'+promotion_id, type:'post', async:false }).responseText; return eval(text); }, jQuery.format({0} is already used, $('#PromotionName').val() )); but dont works
[jQuery] Re: [validation] Remote rule, show loading symbol
You can use various ajax events to handle that, see: http://docs.jquery.com/Ajax_Events Eg. display the loading indicator on ajaxStart and hide it on ajaxStop. Jörn On Mon, Jul 6, 2009 at 8:02 PM, pimoussedelphine.ma...@gmail.com wrote: Hi, I am using a remote rule an external file to check in a form that a username is available. I am trying to show a loading symbol (or a message that says checking your username is available ) while the ajax query is running. Does anyone here know how to do this? Thanks!
[jQuery] Re: [validation] how to return for jquery.Format
Use the remote method: http://docs.jquery.com/Plugins/Validation/Methods/remote#url Jörn On Sat, Jul 4, 2009 at 6:30 PM, Manolet Gmailmano...@gmail.com wrote: Hi, im adding a method. i want to display a message like: THECONTENTOFMYINPUT is already user. this is what im doing. jQuery.validator.addMethod(checkname, function(value, element) { var name = $('#PromotionName').val(); var promotion_id = $('#PromotionId').val(); text = $.ajax({ url: /promotions/checkName/+name+'/'+promotion_id, type:'post', async:false }).responseText; return eval(text); }, jQuery.format({0} is already used, $('#PromotionName').val() )); but dont works
[jQuery] Re: [validation] how to return for jquery.Format
How i can use the remote method to build the url like: /promotions/checkName/+name+'/'+promotion_id, type:'post', ? On Sat, Jul 4, 2009 at 12:08 PM, Jörn Zaeffererjoern.zaeffe...@googlemail.com wrote: Use the remote method: http://docs.jquery.com/Plugins/Validation/Methods/remote#url Jörn On Sat, Jul 4, 2009 at 6:30 PM, Manolet Gmailmano...@gmail.com wrote: Hi, im adding a method. i want to display a message like: THECONTENTOFMYINPUT is already user. this is what im doing. jQuery.validator.addMethod(checkname, function(value, element) { var name = $('#PromotionName').val(); var promotion_id = $('#PromotionId').val(); text = $.ajax({ url: /promotions/checkName/+name+'/'+promotion_id, type:'post', async:false }).responseText; return eval(text); }, jQuery.format({0} is already used, $('#PromotionName').val() )); but dont works
[jQuery] Re: [Validation] Internationalization support
You can write custom methods to extend the plugin with whatever methods you need: http://docs.jquery.com/Plugins/Validation/Validator/addMethod You should be able to use numberDE for that number format. Look at dateDE or any of the other date methods to see how they are implemented. Jörn On Mon, May 18, 2009 at 9:28 PM, MaxMax xana...@geocities.com wrote: Does the JQuery Validation plugin supports internationalization? Here in Italy for example we write 1,5 instead of 1.5 and 1.500,5 instead of 1,500.5 and the dates are in another format (dd/MM/)... Thanks Massimiliano
[jQuery] Re: [Validation] Internationalization support
But all the range, min, max don't work because they use the standard javascript string to number conversions that are USA only. I patched the validation plugin to work in italy (but now it works only in italy) On 18 Mag, 22:22, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You can write custom methods to extend the plugin with whatever methods you need:http://docs.jquery.com/Plugins/Validation/Validator/addMethod You should be able to use numberDE for that number format. Look at dateDE or any of the other date methods to see how they are implemented. Jörn On Mon, May 18, 2009 at 9:28 PM, MaxMax xana...@geocities.com wrote: Does the JQuery Validation plugin supports internationalization? Here in Italy for example we write 1,5 instead of 1.5 and 1.500,5 instead of 1,500.5 and the dates are in another format (dd/MM/)... Thanks Massimiliano- Nascondi testo citato - Mostra testo citato -
[jQuery] Re: [validation] I want to add validation for a reCAPTCHA image. Can I give this field error message a unique class?
You can use the errorPlacement-option to customize the placement. Take a look at the source of this demo for a good example: http://jquery.bassistance.de/validate/demo/milk/ Jörn On Wed, May 13, 2009 at 2:30 AM, wjs3 wjstarrs...@gmail.com wrote: I have a form consisting mainly of text inputs and selects. The inputs are nested within list elements, lists, fieldsets, etc. I have configured the validation plugin to place the error messages after the fields, and successfully used CSS to style the label.error class. I have recently added a reCAPTCHA image to the form. I would like to validate that this field is also not empty before allowing a submit. The reCAPTCHA input however is buried within a td/table/div, so the error message gets crammed into the td with the input and is barely visible. I thought of going into the module and adding some code around the showLabel function to test if the field being referenced is the recaptcha_response_field. If so, I would conditionally assign a unique class to this label so I could try and use CSS to place it elsewhere. I am by no means a javascript expert and am not sure how to do this properly in the code. Any assistance would be much appreciated. Perhaps there is a better way to tackle this as well. Thanks in advance, wjs3
[jQuery] Re: [Validation] Email
Sure, thats just as valid as em...@example.co.uk is. Jörn On Fri, May 8, 2009 at 8:57 PM, Brett bbeard...@gmail.com wrote: I noticed that if you do the email: true in the validation and then try and type an email such as: em...@example.com.com it will mark it as valid. Is this intended? Even says its valid on your test page at: http://docs.jquery.com/Plugins/Validation/Methods/email
[jQuery] Re: validation showErrors error
The .each is the problem: if(data.status == false) { // update form errors $(#calib_entry).validate().showErrors(data.errors); } On May 7, 10:35 am, Brad nrmlcrpt...@gmail.com wrote: I'm using the validation plugin to perform client side validation on a form that uses $.post. To be safe, I also re-validate all inputs on the server side. Ideally I'll never have a case where client-side validation passes but server- side validation fails, but in case I do, I want to display errors back that the browser. I have my server side code returning a JSON object. It contains a status, an errors object, and an info object. The errors object may contain multiple errors. $.post(ajax.php, formdata += 'from=calibtype=submit', function(data){ if(data.status == false) { // update form errors $.each(data.errors, function(fld,msg) { console.log(fld,msg); // See what's coming back. Looks OK! var v = $(#calib_entry).validate(); // because of scoping issues I need to redefine validator v.showErrors({fld:msg}); // = This is throwing a jQuery error }); } ... }, 'json' ); I'm testing my server side validation and have hard-coded bad value so validation will fail. When I call v.showErrors Firebug is showing an error within jQuery itself. Unfortunately the server I'm working against has a minified version installed (I've requested they install the full version). Until I can see where jQuery is failing, can someone who is more familiar with showErrors tell if the problem is how I'm calling it? The console.log call shows that fld and msg are both strings. Thanks, Brad
[jQuery] Re: validation showErrors error
Oops, hit send accidentally. The problem was that I didn't need to iterate over each error. A single call to showErrors handles them all. if(data.status == false) { // update form errors $(#calib_entry).validate().showErrors(data.errors); } On May 7, 10:39 am, Brad nrmlcrpt...@gmail.com wrote: The .each is the problem: if(data.status == false) { // update form errors $(#calib_entry).validate().showErrors(data.errors); } On May 7, 10:35 am, Brad nrmlcrpt...@gmail.com wrote: I'm using the validation plugin to perform client side validation on a form that uses $.post. To be safe, I also re-validate all inputs on the server side. Ideally I'll never have a case where client-side validation passes but server- side validation fails, but in case I do, I want to display errors back that the browser. I have my server side code returning a JSON object. It contains a status, an errors object, and an info object. The errors object may contain multiple errors. $.post(ajax.php, formdata += 'from=calibtype=submit', function(data){ if(data.status == false) { // update form errors $.each(data.errors, function(fld,msg) { console.log(fld,msg); // See what's coming back. Looks OK! var v = $(#calib_entry).validate(); // because of scoping issues I need to redefine validator v.showErrors({fld:msg}); // = This is throwing a jQuery error }); } ... }, 'json' ); I'm testing my server side validation and have hard-coded bad value so validation will fail. When I call v.showErrors Firebug is showing an error within jQuery itself. Unfortunately the server I'm working against has a minified version installed (I've requested they install the full version). Until I can see where jQuery is failing, can someone who is more familiar with showErrors tell if the problem is how I'm calling it? The console.log call shows that fld and msg are both strings. Thanks, Brad
[jQuery] Re: validation plug in flicker
Could you provide a testpage? Haven't seen that yet... Jörn On Fri, Apr 24, 2009 at 4:45 AM, Rabbott abbot...@gmail.com wrote: I am using the jquery validation plugin, i am wanting to place all the errors in one div at the top of the form - which works. The problem is that the first time I submit the form (in FF for MAC) the classes that get assigned to the form elements get added, and removed real quickly. (I have a bg color of red on the form, so i can see a flicker basically) - works just fine in safari. has anyone seen anything like this?
[jQuery] Re: Validation plugin (bassistance.de) problem
Yeah, I know about the regular behaviour, but the problem is that the live validation behaves incorrect. When it validates an input as valid, it sometimes doesn't revalidate it when you clear the field (so it should state as invalid, but it still says it's valid). The behaviours is random. Sometimes it happens on the first field, sometimes on another. On Apr 17, 2:17 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: The behaviour is described here:http://docs.jquery.com/Plugins/Validation/Reference#Validation_event Jörn On Fri, Apr 17, 2009 at 10:46 AM, Jonas jonassa...@gmail.com wrote: Example form:http://jquery.bassistance.de/validate/demo/milk/ (this is the demo for the script onbassistance.de) When it does 'live' validation (on blur) it tells the user if the field is correct or incorrect. When you fill in the first field, tab to the next field, go back to the previous (allready filled in) field and clear it, it still counts as valid (notice the icon next to the field). Since the field is now empty, it should state as invalid, but it doesn't. This behaviour is random, sometimes it works, sometimes it doesn't. Sometimes it happens in the first field, sometimes on one of the other. It only happens before you try to submit the form, after a page submit everything works fine. Anybody who has a clue?
[jQuery] Re: Validation plugin - Using with 'button' buttons?
To be more specific, validation is working prior to clicking the button. For example I have a date field in the form and entering garbage will present an enter a valid date message, but I also have some fields that are simply required. Clicking the button doesn't appear to run any pre-submit validation. BTW, I'm totally new to this plugin. On Apr 22, 9:39 am, Brad nrmlcrpt...@gmail.com wrote: I'm trying to integrate the Validation plugin into an existing project. The forms use AJAX and the buttons are not of type 'submit', but type 'button'. If I change the type to 'submit' I can see validation works, but doing so will require other code changes. Is there any way to get it to work with a 'button' button?
[jQuery] Re: Validation plugin - Using with 'button' buttons?
In the button's click handler: if ($(#myform).validate().form()) { // submit form } On Apr 22, 9:48 am, Brad nrmlcrpt...@gmail.com wrote: To be more specific, validation is working prior to clicking the button. For example I have a date field in the form and entering garbage will present an enter a valid date message, but I also have some fields that are simply required. Clicking the button doesn't appear to run any pre-submit validation. BTW, I'm totally new to this plugin. On Apr 22, 9:39 am, Brad nrmlcrpt...@gmail.com wrote: I'm trying to integrate the Validation plugin into an existing project. The forms use AJAX and the buttons are not of type 'submit', but type 'button'. If I change the type to 'submit' I can see validation works, but doing so will require other code changes. Is there any way to get it to work with a 'button' button?
[jQuery] Re: Validation plugin (bassistance.de) problem
The behaviour is described here: http://docs.jquery.com/Plugins/Validation/Reference#Validation_event Jörn On Fri, Apr 17, 2009 at 10:46 AM, Jonas jonassa...@gmail.com wrote: Example form: http://jquery.bassistance.de/validate/demo/milk/ (this is the demo for the script on bassistance.de) When it does 'live' validation (on blur) it tells the user if the field is correct or incorrect. When you fill in the first field, tab to the next field, go back to the previous (allready filled in) field and clear it, it still counts as valid (notice the icon next to the field). Since the field is now empty, it should state as invalid, but it doesn't. This behaviour is random, sometimes it works, sometimes it doesn't. Sometimes it happens in the first field, sometimes on one of the other. It only happens before you try to submit the form, after a page submit everything works fine. Anybody who has a clue?
[jQuery] Re: Validation plugin (bassistance.de) problem
i also detected some difference between the demo's behavior and the docs. i'm not sure what sequence of ui actions led to the result in the attached png but i've seen it twice now. On 4/17/09 8:17 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: The behaviour is described here: http://docs.jquery.com/Plugins/Validation/Reference#Validation_event Jörn On Fri, Apr 17, 2009 at 10:46 AM, Jonas jonassa...@gmail.com wrote: Example form: http://jquery.bassistance.de/validate/demo/milk/ (this is the demo for the script on bassistance.de) When it does 'live' validation (on blur) it tells the user if the field is correct or incorrect. When you fill in the first field, tab to the next field, go back to the previous (allready filled in) field and clear it, it still counts as valid (notice the icon next to the field). Since the field is now empty, it should state as invalid, but it doesn't. This behaviour is random, sometimes it works, sometimes it doesn't. Sometimes it happens in the first field, sometimes on one of the other. It only happens before you try to submit the form, after a page submit everything works fine. Anybody who has a clue? attachment: Picture-1a.png
[jQuery] Re: Validation and Facebox
Thanks for your advice Byron! I was experiencing the same problem Bob described and your solution worked perfectly. BTW, using clone(true) didn't work in my case neither. On Mar 18, 10:36 am, byron gexma...@gmail.com wrote: In case anyone else stumbles upon this, I will give my solution to the problem (hours later, of course). So the issue is that Facebox is using the clone() method to move the DOM elements around in $.facebox.fillFaceboxFromHref. Now a fix that worked on some of my pages was to simply using the other form of the clone() method - clone(true). Giving the boolean true tells JQuery to copy the event handlers as well as the DOM stuff. Like I said, this only worked on a couple of my pages. The final solution I came upon was to completely change how it sends the DOM element to the reveal method of Facebox. This involved changing the following things: $.extend($.facebox, { settings: { dom_data: null, dom: null, ... *add in the variables dom and dom_data in the main declaration of facebox if (href.match(/#/)) { var url = window.location.href.split('#')[0] var target = href.replace(url,'') $.facebox.settings.dom = target; $.facebox.settings.dom_data = $(target).children(); $.facebox.reveal($(target).children().show(), klass) ... *this is in fillFaceboxFromHref finally, $(document).bind('close.facebox', function() { if($.facebox.settings.dom){ $($.facebox.settings.dom).append($.facebox.settings.dom_data); $.facebox.settings.dom = null; $.facebox.settings.dom_data = null; } ... * this is at the end of the file The changes here are avoiding the cloning process entirely. Instead we are moving the elements to the Facebox and then moving them back when we close the thing. This seems to work. It looks like it is a little slower, or maybe it is just me. Hopefully this helps someone. On Feb 24, 1:57 pm, Bob O sngndn...@gmail.com wrote: Hello, Ive been using the Validation plugin on my site and it works fantastic. i have run into an issue with trying to get it to perform validation on a form that resides in a facebox. I setup the validation the same as any other form in the site. what could i be missing?
[jQuery] Re: Validation plugin remote problem
Could you post a testpage? Can't see anything wrong in the snippets you provided - its probably something seemingly unrelated. Jörn On Sun, Apr 12, 2009 at 4:18 PM, Victorr victor.ry...@gmail.com wrote: Ok. But what do i need too echo to get a false value and an error message? thanks! On 12 Apr, 10:37, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You need to echo true for a valid value. Jörn On Sun, Apr 12, 2009 at 1:02 AM, Victorr victor.ry...@gmail.com wrote: I'm using CakePHP, jQuery and the validation plugin. I'm having some problems. I'm trying to check if a email is already in use but I can't seem to get it too work. I'm just trying to get a error message to see that it works but I can't seem to get it right. Javascript: $(document).ready(function() { $(#UserIndexForm).validate({ rules: { data[User][email]: { required: true, email: true, remote: / }, data[User][passwrd]: { required: true, minlength: 5 }, }, messages: { data[User][email]: { required: Du måste ange en e-post adress., email: Du måste ange en giltig e-post adress., remote: E-post adressen du angav är upptagen. }, data[User][passwrd]: { required: Du måste ange ett lösenord., minlength: Ditt lösenord måste vara minst 5 tecken. } } }); }); And the controller: if ($this-RequestHandler-isAjax() !empty($_REQUEST['data'] ['User']['email'])) { $valid = 'false'; echo $valid; } Thanks!
[jQuery] Re: Validation plugin remote problem
Sure. I translated the error messages to english so that you would understand :) http://betan.midoo.se On 13 Apr, 16:28, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Could you post a testpage? Can't see anything wrong in the snippets you provided - its probably something seemingly unrelated. Jörn On Sun, Apr 12, 2009 at 4:18 PM, Victorr victor.ry...@gmail.com wrote: Ok. But what do i need too echo to get a false value and an error message? thanks! On 12 Apr, 10:37, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You need to echo true for a valid value. Jörn On Sun, Apr 12, 2009 at 1:02 AM, Victorr victor.ry...@gmail.com wrote: I'm using CakePHP, jQuery and the validation plugin. I'm having some problems. I'm trying to check if a email is already in use but I can't seem to get it too work. I'm just trying to get a error message to see that it works but I can't seem to get it right. Javascript: $(document).ready(function() { $(#UserIndexForm).validate({ rules: { data[User][email]: { required: true, email: true, remote: / }, data[User][passwrd]: { required: true, minlength: 5 }, }, messages: { data[User][email]: { required: Du måste ange en e-post adress., email: Du måste ange en giltig e-post adress., remote: E-post adressen du angav är upptagen. }, data[User][passwrd]: { required: Du måste ange ett lösenord., minlength: Ditt lösenord måste vara minst 5 tecken. } } }); }); And the controller: if ($this-RequestHandler-isAjax() !empty($_REQUEST['data'] ['User']['email'])) { $valid = 'false'; echo $valid; } Thanks!
[jQuery] Re: Validation plugin remote problem
The response for the remote request is wrong: http://betan.midoo.se/?data%5BUser%5D%5Bemail%5D=bla%40bla.com That should be just true, nothing else. And, completely unrelated: The error message isn't hidden for a valid field. You can check the state of the field in Firebug. Once its valid, the error-class is removed. But the error label isn't hidden, for whatever reason. To debug this, please include an uncompressed jquery.validate.js file and enable the debug option (debug:true). Jörn On Tue, Apr 14, 2009 at 12:06 AM, Victorr victor.ry...@gmail.com wrote: Sure. I translated the error messages to english so that you would understand :) http://betan.midoo.se On 13 Apr, 16:28, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Could you post a testpage? Can't see anything wrong in the snippets you provided - its probably something seemingly unrelated. Jörn On Sun, Apr 12, 2009 at 4:18 PM, Victorr victor.ry...@gmail.com wrote: Ok. But what do i need too echo to get a false value and an error message? thanks! On 12 Apr, 10:37, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You need to echo true for a valid value. Jörn On Sun, Apr 12, 2009 at 1:02 AM, Victorr victor.ry...@gmail.com wrote: I'm using CakePHP, jQuery and the validation plugin. I'm having some problems. I'm trying to check if a email is already in use but I can't seem to get it too work. I'm just trying to get a error message to see that it works but I can't seem to get it right. Javascript: $(document).ready(function() { $(#UserIndexForm).validate({ rules: { data[User][email]: { required: true, email: true, remote: / }, data[User][passwrd]: { required: true, minlength: 5 }, }, messages: { data[User][email]: { required: Du måste ange en e-post adress., email: Du måste ange en giltig e-post adress., remote: E-post adressen du angav är upptagen. }, data[User][passwrd]: { required: Du måste ange ett lösenord., minlength: Ditt lösenord måste vara minst 5 tecken. } } }); }); And the controller: if ($this-RequestHandler-isAjax() !empty($_REQUEST['data'] ['User']['email'])) { $valid = 'false'; echo $valid; } Thanks!
[jQuery] Re: Validation plugin remote problem
You need to echo true for a valid value. Jörn On Sun, Apr 12, 2009 at 1:02 AM, Victorr victor.ry...@gmail.com wrote: I'm using CakePHP, jQuery and the validation plugin. I'm having some problems. I'm trying to check if a email is already in use but I can't seem to get it too work. I'm just trying to get a error message to see that it works but I can't seem to get it right. Javascript: $(document).ready(function() { $(#UserIndexForm).validate({ rules: { data[User][email]: { required: true, email: true, remote: / }, data[User][passwrd]: { required: true, minlength: 5 }, }, messages: { data[User][email]: { required: Du måste ange en e-post adress., email: Du måste ange en giltig e-post adress., remote: E-post adressen du angav är upptagen. }, data[User][passwrd]: { required: Du måste ange ett lösenord., minlength: Ditt lösenord måste vara minst 5 tecken. } } }); }); And the controller: if ($this-RequestHandler-isAjax() !empty($_REQUEST['data'] ['User']['email'])) { $valid = 'false'; echo $valid; } Thanks!
[jQuery] Re: Validation plugin remote problem
Ok. But what do i need too echo to get a false value and an error message? thanks! On 12 Apr, 10:37, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You need to echo true for a valid value. Jörn On Sun, Apr 12, 2009 at 1:02 AM, Victorr victor.ry...@gmail.com wrote: I'm using CakePHP, jQuery and the validation plugin. I'm having some problems. I'm trying to check if a email is already in use but I can't seem to get it too work. I'm just trying to get a error message to see that it works but I can't seem to get it right. Javascript: $(document).ready(function() { $(#UserIndexForm).validate({ rules: { data[User][email]: { required: true, email: true, remote: / }, data[User][passwrd]: { required: true, minlength: 5 }, }, messages: { data[User][email]: { required: Du måste ange en e-post adress., email: Du måste ange en giltig e-post adress., remote: E-post adressen du angav är upptagen. }, data[User][passwrd]: { required: Du måste ange ett lösenord., minlength: Ditt lösenord måste vara minst 5 tecken. } } }); }); And the controller: if ($this-RequestHandler-isAjax() !empty($_REQUEST['data'] ['User']['email'])) { $valid = 'false'; echo $valid; } Thanks!
[jQuery] Re: Validation CheckBoxes group
Luigi, This should work for you: var isChecked = false; $('.campi[name=license]').each(function(){ if ( $(this).attr('checked') ) isChecked = true; }); SEAN O http://www.sean-o.com Ciupaz wrote: Hi all, in my .aspx page I have a series of checkboxes for the driver license: input name=license type=checkbox value=A /A input name=license type=checkbox value=B /B input name=license type=checkbox value=C /C input name=license type=checkbox value=D /D input name=license type=checkbox value=E /E input name=license type=checkbox value=F /F input name=license type=checkbox value=K /K How can I validate that at least one of them is checked? (one or more). Thanks in advance. Luigi -- View this message in context: http://www.nabble.com/Validation-CheckBoxes-group-tp22906364s27240p22908236.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: [validation]
See any of the localization files for reference: http://jqueryjs.googlecode.com/svn/trunk/plugins/validate/localization/messages_nl.js Jörn On Thu, Apr 2, 2009 at 8:01 AM, david.garc...@barcelonamedia.org david.garc...@barcelonamedia.org wrote: Hello, I am using jQuery validation plugin. I have read about the plugin in your website as well as in jQuery plugins forums. I am using it and it works perfectly. My doubt is how can I use the localize messages? I don't know if the plugin has a method or a way to access the messages or I have to get them manually, as these messages are inside: jQuery.extend(jQuery.validator.messages, {...}); If I use, for example, the message in 'required' variable, it does not work, as I try to get it by using simply 'required'. I suppose this is because 'required' is inside the function jQuery.validator.messages. that's why I ask you if the oplugin has a method itself to get these messages. Thanks, David
[jQuery] Re: [validation]
Hi Jörn, yes I have had a look at the lozalization files. I have even create one. What I would like to know is how the plugin manages these files, as I don't know how to access them. Does the plugin itself retrieve the proper localization file? I have retrieve it by means of a localization plugin, but I don't know if I am doing it the right way. Does the plugin have any method to load any message of the proper lozalization file? If not, how could I get the message. For example, insted of this: messages: { name: Please enter your firstname, surname: Please enter your lastname, usr: { required: Please enter a username, minlength: Your username must consist of at least 2 characters }, psswrd: { required: Please provide a password, minlength: Your password must be at least 5 characters long }, check_password: { required: Please provide a password, minlength: Your password must be at least 5 characters long, equalTo: Please enter the same password as above }, mail: Please enter a valid email address, } I would like to do this: messages: { name: required surname: required, usr: { required: required, minlength: minlength }, psswrd: { required: required, minlength: minlength }, check_password: { required: required, minlength: minlength, equalTo: equalTo }, mail: email, } Where required, minlength, etc. are defined in the lozalization file, but it does not work. David On 2 abr, 10:11, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: See any of the localization files for reference:http://jqueryjs.googlecode.com/svn/trunk/plugins/validate/localizatio... Jörn On Thu, Apr 2, 2009 at 8:01 AM, david.garc...@barcelonamedia.org david.garc...@barcelonamedia.org wrote: Hello, I am using jQuery validation plugin. I have read about the plugin in your website as well as in jQuery plugins forums. I am using it and it works perfectly. My doubt is how can I use the localize messages? I don't know if the plugin has a method or a way to access the messages or I have to get them manually, as these messages are inside: jQuery.extend(jQuery.validator.messages, {...}); If I use, for example, the message in 'required' variable, it does not work, as I try to get it by using simply 'required'. I suppose this is because 'required' is inside the function jQuery.validator.messages. that's why I ask you if the oplugin has a method itself to get these messages. Thanks, David
[jQuery] Re: Validation one field depends on the value of another field
The infamous jQuery Validate Plug-in gets the job done: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ On Apr 2, 3:03 am, dremay anieshjos...@gmail.com wrote: Hello, I want to validate a field by using JQuery and it also need to consider the value of another field during the checking. I have the following: input type=text id=region name=region input type=text id=place name=place When someone press the submit button, i want to validate the place value by using Ajax.. And also need to pass the value of region. Please help me Thank You
[jQuery] Re: Validation Success Callback
The single quotes around the window.location worked like a charm... Thanks a lot for your help! On Mar 31, 7:32 pm, James james.gp@gmail.com wrote: Slight typo on the second option: setTimeOut(doSomething, 5000); function doSomething() { window.location = 'http://www.google.com'; } On Mar 31, 2:31 pm, James james.gp@gmail.com wrote: In some common ways, you'd have to either do it: setTimeOut(function() { window.location = 'http://www.google.com'; }, 5000); or: setTimeOut(doSomething, 5000); doSomething() { window.location = 'http://www.google.com'; } or: setTimeout('window.location = http://www.google.com;', 5000); On Mar 31, 2:28 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: setTimeout(window.location = http://www.google.com;, 5000); It seems that the script just completely ignores the timeout but executes the code anyways... What is really weird is that if I put some other code on a timer then it works correctly so maybe I am doing the redirect wrong?? On Mar 30, 9:38 pm, James james.gp@gmail.com wrote: Can you show us how the //redirect part of the code looks like? It should be on the lines of something like: setTimeOut(function() { location.href = '/somepage'; }, 2000); On Mar 30, 4:05 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: Yeah, that was just a typo on my behalf... The actual code does list the correct code... Any idea what I am doing wrong? On Mar 27, 1:17 pm, James james.gp@gmail.com wrote: Javascript is case-sensitive: 'setTimeOut' should be 'setTimeout' On Mar 26, 5:08 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: I am using the validation plugin and the form plugin to validate my form and then submit the information via ajaxSubmit. I have everything working with the exception of my success callback function. Once the form is successfully validated I just want to wait about 2 - 3 seconds to run a script and then redirect the user to a new page. This works but the code is executed immediately: var options = { success: createAccount, clearForm: true }; $(#submitForm).validate({ rules: { //Insert Rules Here }, messages: { //Insert Messages Here }, submitHandler: function(form) { jQuery(form).ajaxSubmit(options); } }); function createAccount () { //Do Stuff setTimeOut(//Redirect, 2000); } So instead of waiting 2 seconds to redirect the code is executed as if the timer isn't even there!! Can anyone please help me with this? I have tried everything and still the timer does not work!!- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Validation Success Callback
setTimeout(window.location = http://www.google.com;, 5000); It seems that the script just completely ignores the timeout but executes the code anyways... What is really weird is that if I put some other code on a timer then it works correctly so maybe I am doing the redirect wrong?? On Mar 30, 9:38 pm, James james.gp@gmail.com wrote: Can you show us how the //redirect part of the code looks like? It should be on the lines of something like: setTimeOut(function() { location.href = '/somepage'; }, 2000); On Mar 30, 4:05 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: Yeah, that was just a typo on my behalf... The actual code does list the correct code... Any idea what I am doing wrong? On Mar 27, 1:17 pm, James james.gp@gmail.com wrote: Javascript is case-sensitive: 'setTimeOut' should be 'setTimeout' On Mar 26, 5:08 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: I am using the validation plugin and the form plugin to validate my form and then submit the information via ajaxSubmit. I have everything working with the exception of my success callback function. Once the form is successfully validated I just want to wait about 2 - 3 seconds to run a script and then redirect the user to a new page. This works but the code is executed immediately: var options = { success: createAccount, clearForm: true }; $(#submitForm).validate({ rules: { //Insert Rules Here }, messages: { //Insert Messages Here }, submitHandler: function(form) { jQuery(form).ajaxSubmit(options); } }); function createAccount () { //Do Stuff setTimeOut(//Redirect, 2000); } So instead of waiting 2 seconds to redirect the code is executed as if the timer isn't even there!! Can anyone please help me with this? I have tried everything and still the timer does not work!!- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Validation Success Callback
In some common ways, you'd have to either do it: setTimeOut(function() { window.location = 'http://www.google.com'; }, 5000); or: setTimeOut(doSomething, 5000); doSomething() { window.location = 'http://www.google.com'; } or: setTimeout('window.location = http://www.google.com;', 5000); On Mar 31, 2:28 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: setTimeout(window.location = http://www.google.com;, 5000); It seems that the script just completely ignores the timeout but executes the code anyways... What is really weird is that if I put some other code on a timer then it works correctly so maybe I am doing the redirect wrong?? On Mar 30, 9:38 pm, James james.gp@gmail.com wrote: Can you show us how the //redirect part of the code looks like? It should be on the lines of something like: setTimeOut(function() { location.href = '/somepage'; }, 2000); On Mar 30, 4:05 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: Yeah, that was just a typo on my behalf... The actual code does list the correct code... Any idea what I am doing wrong? On Mar 27, 1:17 pm, James james.gp@gmail.com wrote: Javascript is case-sensitive: 'setTimeOut' should be 'setTimeout' On Mar 26, 5:08 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: I am using the validation plugin and the form plugin to validate my form and then submit the information via ajaxSubmit. I have everything working with the exception of my success callback function. Once the form is successfully validated I just want to wait about 2 - 3 seconds to run a script and then redirect the user to a new page. This works but the code is executed immediately: var options = { success: createAccount, clearForm: true }; $(#submitForm).validate({ rules: { //Insert Rules Here }, messages: { //Insert Messages Here }, submitHandler: function(form) { jQuery(form).ajaxSubmit(options); } }); function createAccount () { //Do Stuff setTimeOut(//Redirect, 2000); } So instead of waiting 2 seconds to redirect the code is executed as if the timer isn't even there!! Can anyone please help me with this? I have tried everything and still the timer does not work!!- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Validation Success Callback
Slight typo on the second option: setTimeOut(doSomething, 5000); function doSomething() { window.location = 'http://www.google.com'; } On Mar 31, 2:31 pm, James james.gp@gmail.com wrote: In some common ways, you'd have to either do it: setTimeOut(function() { window.location = 'http://www.google.com'; }, 5000); or: setTimeOut(doSomething, 5000); doSomething() { window.location = 'http://www.google.com'; } or: setTimeout('window.location = http://www.google.com;', 5000); On Mar 31, 2:28 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: setTimeout(window.location = http://www.google.com;, 5000); It seems that the script just completely ignores the timeout but executes the code anyways... What is really weird is that if I put some other code on a timer then it works correctly so maybe I am doing the redirect wrong?? On Mar 30, 9:38 pm, James james.gp@gmail.com wrote: Can you show us how the //redirect part of the code looks like? It should be on the lines of something like: setTimeOut(function() { location.href = '/somepage'; }, 2000); On Mar 30, 4:05 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: Yeah, that was just a typo on my behalf... The actual code does list the correct code... Any idea what I am doing wrong? On Mar 27, 1:17 pm, James james.gp@gmail.com wrote: Javascript is case-sensitive: 'setTimeOut' should be 'setTimeout' On Mar 26, 5:08 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: I am using the validation plugin and the form plugin to validate my form and then submit the information via ajaxSubmit. I have everything working with the exception of my success callback function. Once the form is successfully validated I just want to wait about 2 - 3 seconds to run a script and then redirect the user to a new page. This works but the code is executed immediately: var options = { success: createAccount, clearForm: true }; $(#submitForm).validate({ rules: { //Insert Rules Here }, messages: { //Insert Messages Here }, submitHandler: function(form) { jQuery(form).ajaxSubmit(options); } }); function createAccount () { //Do Stuff setTimeOut(//Redirect, 2000); } So instead of waiting 2 seconds to redirect the code is executed as if the timer isn't even there!! Can anyone please help me with this? I have tried everything and still the timer does not work!!- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Validation
As the author, I recommend this plugin: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ You always have to write serverside validation. Clientside validation must be entirely optional. Thats pretty much all there is. Jörn On Sun, Mar 29, 2009 at 4:05 PM, iceangel89 iceange...@gmail.com wrote: whats the best way/plugin for validation in jquery? just wondering whats the best practice for validation if user disables js?
[jQuery] Re: Validation Success Callback
Yeah, that was just a typo on my behalf... The actual code does list the correct code... Any idea what I am doing wrong? On Mar 27, 1:17 pm, James james.gp@gmail.com wrote: Javascript is case-sensitive: 'setTimeOut' should be 'setTimeout' On Mar 26, 5:08 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: I am using the validation plugin and the form plugin to validate my form and then submit the information via ajaxSubmit. I have everything working with the exception of my success callback function. Once the form is successfully validated I just want to wait about 2 - 3 seconds to run a script and then redirect the user to a new page. This works but the code is executed immediately: var options = { success: createAccount, clearForm: true }; $(#submitForm).validate({ rules: { //Insert Rules Here }, messages: { //Insert Messages Here }, submitHandler: function(form) { jQuery(form).ajaxSubmit(options); } }); function createAccount () { //Do Stuff setTimeOut(//Redirect, 2000); } So instead of waiting 2 seconds to redirect the code is executed as if the timer isn't even there!! Can anyone please help me with this? I have tried everything and still the timer does not work!!- Hide quoted text - - Show quoted text -
[jQuery] Re: Validation Success Callback
Can you show us how the //redirect part of the code looks like? It should be on the lines of something like: setTimeOut(function() { location.href = '/somepage'; }, 2000); On Mar 30, 4:05 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: Yeah, that was just a typo on my behalf... The actual code does list the correct code... Any idea what I am doing wrong? On Mar 27, 1:17 pm, James james.gp@gmail.com wrote: Javascript is case-sensitive: 'setTimeOut' should be 'setTimeout' On Mar 26, 5:08 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: I am using the validation plugin and the form plugin to validate my form and then submit the information via ajaxSubmit. I have everything working with the exception of my success callback function. Once the form is successfully validated I just want to wait about 2 - 3 seconds to run a script and then redirect the user to a new page. This works but the code is executed immediately: var options = { success: createAccount, clearForm: true }; $(#submitForm).validate({ rules: { //Insert Rules Here }, messages: { //Insert Messages Here }, submitHandler: function(form) { jQuery(form).ajaxSubmit(options); } }); function createAccount () { //Do Stuff setTimeOut(//Redirect, 2000); } So instead of waiting 2 seconds to redirect the code is executed as if the timer isn't even there!! Can anyone please help me with this? I have tried everything and still the timer does not work!!- Hide quoted text - - Show quoted text -
[jQuery] Re: Validation Success Callback
Javascript is case-sensitive: 'setTimeOut' should be 'setTimeout' On Mar 26, 5:08 pm, MonkeyBall2010 hughes.timo...@gmail.com wrote: I am using the validation plugin and the form plugin to validate my form and then submit the information via ajaxSubmit. I have everything working with the exception of my success callback function. Once the form is successfully validated I just want to wait about 2 - 3 seconds to run a script and then redirect the user to a new page. This works but the code is executed immediately: var options = { success: createAccount, clearForm: true }; $(#submitForm).validate({ rules: { //Insert Rules Here }, messages: { //Insert Messages Here }, submitHandler: function(form) { jQuery(form).ajaxSubmit(options); } }); function createAccount () { //Do Stuff setTimeOut(//Redirect, 2000); } So instead of waiting 2 seconds to redirect the code is executed as if the timer isn't even there!! Can anyone please help me with this? I have tried everything and still the timer does not work!!