[jQuery] Validation plugin
I am testing this plugin (in conjunction with another called 'InFieldLabel.js' that merely fades back the label on focus) and am getting a strange effect where only some of the fields validate. The test page is: http://www.richardbarnfather.co.uk/esu/php/booking_mike.php All fields have a class of 'required' and the email field has additionally the class of 'email'. Leave all fields blank and click Submit and you'll see what I mean. If anyone can shed any light on why this is happening, I would be very grateful.
Re: [jQuery] Validation plugin
On Mon, Jan 18, 2010 at 4:55 AM, perkin5 mshe...@btinternet.com wrote: http://www.richardbarnfather.co.uk/esu/php/booking_mike.php All fields have a class of 'required' and the email field has The fields that aren't validating have typos in the class setting - they're missing the equals sign: classrequired instead of class=required.
[jQuery] Validation plugin: two fields on the same function?
Hello everyone, I'm using the validation plugin. I have a function which handles a field: it's required if the function returns true, otherwise it is not: q[1]: { required: function () { ... } } And what if I need two fields to be handled with the same function? How can I shorten this for not to write the function two times?) Thanks! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule
[jQuery] Validation Plugin
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: jQuery Validation Plugin messages by field rule.
Didnt i try that... :P. Thanks a lot for soulution and quick response!! That did a exactly what i wanted. On 19 joulu, 22:25, Andre Polykanine an...@oire.org wrote: Hello Antti and all, You just don't need to nestmessages, they should be overwritten: inputfield_2: { // THIS IS WHAT I WOULD LIKE TO HAVE required:inputfield 2 required message, maxlength:inputfield 2 maxlength message, customRule: maybe overwrite custom message here } -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Antti antti.mak...@mindworks.fi To:jQuery(English) jquery-en@googlegroups.com Date: Saturday, December 19, 2009, 12:09:32 PM Subject: [jQuery]jQueryValidationPluginmessagesby field rule. Hi! Im quite newbie withjquerybut so far i think it realy rocks. Anyways im now trying to useValidationpluginbut have one problem to solve to get in job done. My form has natrually many fields, each field can have many rules, even custom rules. Trouble is that i cant find a way to overwrite defaultmessagesby fields rule. For example i wanna different errormessagesfor first_field required message and first_field minlength message. And thosemessageswould need to be different than second_field with same rules but differentmessages. (Dont know if nestedmessagesis right word for what i want) Code what i have. jQuery.validator.setDefaults({ debug: true, success: valid, }); jQuery.validator.addMethod(customRule,function (value) { var i; for (i=0; i arr.length; i++) { if (arr[i].value == value ) { return true; } } return false; }, CustomRule message.); $(document).ready( function(){ var validator = $(#form).validate({ rules: { inputfield_1: { required: true }, inputfield_2: { required: true, maxlength: 5, customRule: true } }, messages: { inputfield_1: inputfield1 message , inputfield_2: { // THIS IS WHAT I WOULD LIKE TO HAVE messages: { required:inputfield 2 required message, maxlength:inputfield 2 maxlength message, customRule: maybe overwrite custom message here } } } }); Hope you understand my problem... I would be realy glad if someone could. Thanks for advance!
[jQuery] jQuery Validation Plugin messages by field rule.
Hi! Im quite newbie with jquery but so far i think it realy rocks. Anyways im now trying to use Validation plugin but have one problem to solve to get in job done. My form has natrually many fields, each field can have many rules, even custom rules. Trouble is that i cant find a way to overwrite default messages by fields rule. For example i wanna different error messages for first_field required message and first_field minlength message. And those messages would need to be different than second_field with same rules but different messages. (Dont know if nested messages is right word for what i want) Code what i have. jQuery.validator.setDefaults({ debug: true, success: valid, }); jQuery.validator.addMethod(customRule,function (value) { var i; for (i=0; i arr.length; i++) { if (arr[i].value == value ) { return true; } } return false; }, CustomRule message.); $(document).ready( function(){ var validator = $(#form).validate({ rules: { inputfield_1: { required: true }, inputfield_2: { required: true, maxlength: 5, customRule: true } }, messages: { inputfield_1: inputfield1 message , inputfield_2: { // THIS IS WHAT I WOULD LIKE TO HAVE messages: { required:inputfield 2 required message, maxlength:inputfield 2 maxlength message, customRule: maybe overwrite custom message here } } } }); Hope you understand my problem... I would be realy glad if someone could. Thanks for advance!
Re: [jQuery] jQuery Validation Plugin messages by field rule.
Hello Antti and all, You just don't need to nest messages, they should be overwritten: inputfield_2: { // THIS IS WHAT I WOULD LIKE TO HAVE required:inputfield 2 required message, maxlength:inputfield 2 maxlength message, customRule: maybe overwrite custom message here } -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Antti antti.mak...@mindworks.fi To: jQuery (English) jquery-en@googlegroups.com Date: Saturday, December 19, 2009, 12:09:32 PM Subject: [jQuery] jQuery Validation Plugin messages by field rule. Hi! Im quite newbie with jquery but so far i think it realy rocks. Anyways im now trying to use Validation plugin but have one problem to solve to get in job done. My form has natrually many fields, each field can have many rules, even custom rules. Trouble is that i cant find a way to overwrite default messages by fields rule. For example i wanna different error messages for first_field required message and first_field minlength message. And those messages would need to be different than second_field with same rules but different messages. (Dont know if nested messages is right word for what i want) Code what i have. jQuery.validator.setDefaults({ debug: true, success: valid, }); jQuery.validator.addMethod(customRule,function (value) { var i; for (i=0; i arr.length; i++) { if (arr[i].value == value ) { return true; } } return false; }, CustomRule message.); $(document).ready( function(){ var validator = $(#form).validate({ rules: { inputfield_1: { required: true }, inputfield_2: { required: true, maxlength: 5, customRule: true } }, messages: { inputfield_1: inputfield1 message , inputfield_2: { // THIS IS WHAT I WOULD LIKE TO HAVE messages: { required:inputfield 2 required message, maxlength:inputfield 2 maxlength message, customRule: maybe overwrite custom message here } } } }); Hope you understand my problem... I would be realy glad if someone could. Thanks for advance!
[jQuery] Validation plugin: required by condition
Hello everyone, I have a text field (textarea) that is required only if a specific radio button in the group is checked. Here's the explanation: a blog entry may be a personal entry, a publication and a news post. If it's a news post or a publication, then the announce is required. How can I manage that with the plugin? what rule do I use? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule
Re: [jQuery] Validation plugin: required by condition
Something like this: input type=radio name=blog-entry value=personal-entry/ input type=radio name=blog-entry value=publication/ input type=radio name=blog-entry value=post/ textarea name=announce/textarea $(form).validate({ rules:{ announce: { required: function(element) { var value = $(input[name='blog-entry']).val(); if ( val == 'publication' || val == 'post' ){ return true; }else{ return false; } } } } }); On Tue, Dec 15, 2009 at 11:24, Andre Polykanine an...@oire.org wrote: Hello everyone, I have a text field (textarea) that is required only if a specific radio button in the group is checked. Here's the explanation: a blog entry may be a personal entry, a publication and a news post. If it's a news post or a publication, then the announce is required. How can I manage that with the plugin? what rule do I use? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule
Re[2]: [jQuery] Validation plugin: required by condition
Hello Leonardo and all, Ok, that's well! And if I need to bind a click event to the group of radiobuttons, how can I do that? If I write something like this: $(#utype1).click (function (event) { if ($(this).is(:checked)) $(#showann).hide(); else $(#showann).show(); }); the #showann div will be processed only when clicking the first radio button. How do I process them all? -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Leonardo K leo...@gmail.com To: jquery-en@googlegroups.com jquery-en@googlegroups.com Date: Tuesday, December 15, 2009, 3:58:52 PM Subject: [jQuery] Validation plugin: required by condition Something like this: input type=radio name=blog-entry value=personal-entry/ input type=radio name=blog-entry value=publication/ input type=radio name=blog-entry value=post/ textarea name=announce/textarea $(form).validate({ rules:{ announce: { required: function(element) { var value = $(input[name='blog-entry']).val(); if ( val == 'publication' || val == 'post' ){ return true; }else{ return false; } } } } }); On Tue, Dec 15, 2009 at 11:24, Andre Polykanine an...@oire.org wrote: Hello everyone, I have a text field (textarea) that is required only if a specific radio button in the group is checked. Here's the explanation: a blog entry may be a personal entry, a publication and a news post. If it's a news post or a publication, then the announce is required. How can I manage that with the plugin? what rule do I use? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule
Re: [jQuery] validation plugin. errorplacement and onblur
You can use the errorLabelContainer to put all your label in a div, and the plugin will handle this. errorLabelContainer: #messageBox, On Sun, Dec 13, 2009 at 09:33, Droy droy...@gmail.com wrote: Greetings! I had a small problem: all errors received in plugin validation I take out in div the block with id = error. errorPlacement: function (error) { $ (' #error ').html (error); } All works well. But when the user has corrected the data on correct in case of an error errors from the block div it is not removed. It is clear, because html - joining. As to me to set property: onblur that if there were no errors, in the block div already described errors were removed?
[jQuery] validation plugin. errorplacement and onblur
Greetings! I had a small problem: all errors received in plugin validation I take out in div the block with id = error. errorPlacement: function (error) { $ (' #error ').html (error); } All works well. But when the user has corrected the data on correct in case of an error errors from the block div it is not removed. It is clear, because html - joining. As to me to set property: onblur that if there were no errors, in the block div already described errors were removed?
[jQuery] validation plugin: how to use EqualTo
Dear all, I'm trying to use the jquery validation plug in to verify that two fields (email addresses) are the same. If read through the tutorials etc but it does not work. I wondering whether I am using it in the right way. I want to validate each field individually so I use onblur to execute the validation. This is my first field and this validation works. dd id=ext_email-element input id=ext_email class=required email valid type=text onblur=$(forms[0]).validate().element( #ext_email ); value= name=ext_email/ label class=error for=ext_email generated=truePlease enter a valid email address./label /dd This is my second field. I want this field to be identical to ext_email. The following validation does not work. dd id=check_ext_email-element input id=check_ext_email class= {equalTo:#ext_email} valid type=text onblur=$(forms[0]).validate().element ( #check_ext_email ); value= name=check_ext_email/ /dd Firebug says that the onblur statement is true. Am I using the plug in in the correcty way? Can someone point me in the right direction? Thanks, /S
[jQuery] JQuery validation plugin - custom validation for group of html elements
I have a set of combo boxes on a HTML form which act as a Date control: div id=datecheck select id=datecheck_y name=datecheck_y option value=20092009/option option value=20082008/option option value=/option /select select id=datecheck_m name=datecheck_m option value=1Jab/option option value=2Feb/option option value=/option /select select id=datecheck_d name=datecheck_d option value=11/option option value=3131/option option value=/option /select /div No I want to validate whether the user has left any value (year/month/day) as blank, or if the values form a valid date (example invalid date: 2009(datecheck_y),Feb(datecheck_m),31(datecheck_d) For this I wrote two custom rules in JQuery, here is my approach: I have two custom rules (REQUIRED_DATE, VALID_DATE): $().ready(function() { $.validator.addMethod(REQUIRED_DATE, function(value, element) { CheckBlankDate(element); }, Date cannot be left blank); $.validator.addMethod(VALID_DATE, function(value, element) { return this.optional(element) || CheckDate(element); }, Date should be valid); $(#form1).validate({ rules: { datecheck: { REQUIRED_DATE: true,VALID_DATE: true } }, messages: { datecheck: { REQUIRED_DATE: Date is required, VALID_DATE: Date should be valid } } }); }); Here are the CheckDate, CheckDateBlank JavaScript functions for reference: function ValidateDate(y, mo, d, h, mi, s) { var date = new Date(y, mo - 1, d, h, mi, s, 0); var ny = date.getFullYear(); var nmo = date.getMonth() + 1; var nd = date.getDate(); var nh = date.getHours(); var nmi = date.getMinutes(); var ns = date.getSeconds(); var flag = (ny == y nmo == mo nd == d nh == h nmi == mi ns == s); return (flag); } function CheckDate(dateElement) { var y, mo, d, h, mi, s; y = document.getElementById(dateElement.id + '_y').value; mo = document.getElementById(dateElement.id + '_m').value; d = document.getElementById(dateElement.id + '_d').value; h = document.getElementById(dateElement.id + '_h').value; mi = document.getElementById(dateElement.id + '_min').value; s = 0; return ValidateDate(y, mo, d, h, mi, s); } function CheckBlankDate(dateElement) { var y, mo, d, h, mi, s; y = document.getElementById(dateElement.id + '_y').value; mo = document.getElementById(dateElement.id + '_m').value; d = document.getElementById(dateElement.id + '_d').value; h = document.getElementById(dateElement.id + '_h').value; mi = document.getElementById(dateElement.id + '_min').value; s = 0; if(y== || mo == || d==) { return false; } return true; } This approach does not work, as I believe JQuery cannot find any input element with name datecheck. Is there any other approach that we can follow? -- View this message in context: http://old.nabble.com/JQuery-validation-plugin---custom-validation-for-group-of-html-elements-tp26421224s27240p26421224.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] JQuery validation plugin - custom validation for group of html elements
I have a set of combo boxes on a HTML form which act as a Date control: div id=datecheck select id=datecheck_y name=datecheck_y option value=20092009/option option value=20082008/option option value=/option /select select id=datecheck_m name=datecheck_m option value=1Jab/option option value=2Feb/option option value=/option /select select id=datecheck_d name=datecheck_d option value=11/option option value=3131/option option value=/option /select /div No I want to validate whether the user has left any value (year/month/ day) as blank, or if the values form a valid date (example invalid date: 2009(datecheck_y),Feb(datecheck_m),31(datecheck_d) For this I wrote two custom rules in JQuery, here is my approach: I have two custom rules (REQUIRED_DATE, VALID_DATE): $().ready(function() { $.validator.addMethod(REQUIRED_DATE, function(value, element) { CheckBlankDate(element); }, Date cannot be left blank); $.validator.addMethod(VALID_DATE, function(value, element) { return this.optional(element) || CheckDate(element); }, Date should be valid); $(#form1).validate({ rules: { datecheck: { REQUIRED_DATE: true,VALID_DATE: true } }, messages: { datecheck: { REQUIRED_DATE: Date is required, VALID_DATE: Date should be valid } } }); }); Here are the CheckDate, CheckDateBlank JavaScript functions for reference: function ValidateDate(y, mo, d, h, mi, s) { var date = new Date(y, mo - 1, d, h, mi, s, 0); var ny = date.getFullYear(); var nmo = date.getMonth() + 1; var nd = date.getDate(); var nh = date.getHours(); var nmi = date.getMinutes(); var ns = date.getSeconds(); var flag = (ny == y nmo == mo nd == d nh == h nmi == mi ns == s); return (flag); } function CheckDate(dateElement) { var y, mo, d, h, mi, s; y = document.getElementById(dateElement.id + '_y').value; mo = document.getElementById(dateElement.id + '_m').value; d = document.getElementById(dateElement.id + '_d').value; h = document.getElementById(dateElement.id + '_h').value; mi = document.getElementById(dateElement.id + '_min').value; s = 0; return ValidateDate(y, mo, d, h, mi, s); } function CheckBlankDate(dateElement) { var y, mo, d, h, mi, s; y = document.getElementById(dateElement.id + '_y').value; mo = document.getElementById(dateElement.id + '_m').value; d = document.getElementById(dateElement.id + '_d').value; h = document.getElementById(dateElement.id + '_h').value; mi = document.getElementById(dateElement.id + '_min').value; s = 0; if(y== || mo == || d==) { return false; } return true; } This approach does not work, as I believe JQuery cannot find any input element with name datecheck. Is there any other approach that we can follow?
[jQuery] Validation plugin rules() ???
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] Validation Plugin + jNice
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] Validation Plugin + jNice
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] (validation) jQuery validation plugin and FormWizard
Hi All! I have a really, really long form (about 300 fields) that I broke down into different sections using this slick a href=http:// www.jankoatwarpspeed.com/post/2009/09/28/webform-wizard-jquery.aspxjQuery plugin Form Wizard/a. If you group your form into different fieldsets, the FormWizard will automagically display one section at a time, with a Next hyperlink to take you to the next section with codea id=step0Next class=next href=#Next /a/code My question is this: Using the jQuery Validation plugin, how can I validate each fieldset when a user clicks Next, and so forth, instead of using the Submit button - how can I validate the form in steps rather than all at once? Put differently, how can I change the trigger event from Submit to six different hyperlinks for six separate sections? Thanks for helping this newb out.
[jQuery] JQuery validation plugin - error highlight problem
I have a form with two input textboxes, and I have included JQuery validation rules for both: script src=../../Scripts/jquery-validate/jquery.validate.js type=text/javascript/script script type=text/javascript $(document).ready(function() { $('#respondForm').validate({ onclick: false, onkeyup: false, onfocusout: false, highlight: function(element, errorClass) { $(element).css({ backgroundColor: 'Red' }); } , errorLabelContainer: $(ul, $('div.error-container')), wrapper: 'li', rules: { 'text': { required: true , minlength: 5 , maxlength: 10 }, integer: { required: true, range: [0, 90] } } , messages: { 'text': { required: xxx_Required , minlength: XXX Should be greater than 5 , maxlength: XXX Cannot be greater than 10 }, integer: { required: is required, range: is out of range: [0,90] } } }); }); /script /head . . . input type=text id=text name=text / br / input type=text id=integer name=integer / br / input type=submit name=submit value=Submit / br / I have used: function(element, errorClass) { $(element).css({ backgroundColor: 'Red' }); } to highlight the error control. Now the problem is that in the following scenario, both the input textboxes remain highlighted (background color: red): 1. Input text with less than 5 characters in text box 1 2. Leave text box 2 blank 3. Hit submit 4. Both input text box background will be changed to red (which is correct) 5. Now enter a text which has 6 characters in text box 1(valid input) 6. Leave text box 2 empty 7. Hit submit 8. The background color for both the textboxes remains red. Where as the expectation is that the background color of text box 1 should not be red How do i resolve this problem? -- View this message in context: http://old.nabble.com/JQuery-validation-plugin---error-highlight-problem-tp26282040s27240p26282040.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] validation plugin addMethod does not work for me.
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] Validation plugin: textarea to allow only digits, but allowing linebreaks?
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.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] jquery validation plugin issue with IE 8
I have a problem with the validation plugin when I add a new validation method in IE8, when I submit the form it just validate the added method but the other fields are submitted anyway. Also I have another problem with the valid() function, when I try to see if the function is true to show a confirmation message IE8 show the javascript error: 'settings' is null or not an object Line: 788 Character: 3 There is the way I add the new validation method: script type=text/javascript $(document).ready(function(){ $.validator.addMethod(nonEmptyTable, function(value, element) { return get_table_data(); }, 'xxx.'); $(#OrdenForm).validate({ rules: { id_orden:{required:true}, fecha_sol: {required:true, dateISO: true}, concepto: {required:true}, cen_cos: {nonEmptyTable:true}, val_tot: {required:true, number:true} }, messages:{ id_orden: {required:xxx}, fecha_sol: {required:xxx}, concepto: {required:xxx }, cen_cos: {nonEmptyTable:xxx}, val_tot: {required: xxx} } }); }); /script There's how I do the submit verification to show the dialog script type=text/javascript $(function(){ $(#dialog).dialog({ bgiframe: true, autoOpen: false, height: 160, width: 330, modal: true, buttons: { 'OK': function() { document.OrdenForm.submit(); }, 'Cancel': function() { $(this).dialog('close'); } } }); $('#OrdenForm').submit(function(){ if($('#OrdenForm').valid()) { $('#dialog').dialog('open'); return false; } }); }); /script Any help will be very appreciated...
[jQuery] validation plugin
Hi, I want to stop class error added to input element, how to do that please ?
[jQuery] Jquery Validation plugin doesn't working on ASP NET MVC
I'm trying to use the Jquery Validation plugin on aspnet mvc fframework but it doesn't work, when I open the firebug console it display an error: jQuery is not defined [Break on this error] jQuery.extend(jQuery.fn, {\n I don´t know how to fix this issue an had already added the jquery-1.3.2.js to my scripts, there is the valdiation code I'm using: script type=text/javascript src=../../Scripts/ jquery.validate.js/script script type=text/javascript src=../../Scripts/ jquery-1.3.2.js/script script type=text/javascript $(document).ready(function(){ $(#simpleSignUp).validate(); }); /script form id=simpleSignUpForm action= method=get input type=text id=firstname class=required minlength=2/ input type=text id=lastname class=required minlength=2/ input type=text id=username class=required minlength=2/ input type=text id=email class=required email minlength=2/ input type=text id=password class=required minlength=8 / input type=text id=website class=url / input type=submit value=Submit / /form Any help will be very appreciate, Thanks in advance...
[jQuery] Re: Jquery Validation plugin doesn't working on ASP NET MVC
You need to reverse the order of sourcing the javascript files. Put the jquery 1.3.2.js file before the validate.js. -Anoop On 8/27/09, Edgar Méndez. edgar9...@gmail.com wrote: I'm trying to use the Jquery Validation plugin on aspnet mvc fframework but it doesn't work, when I open the firebug console it display an error: jQuery is not defined [Break on this error] jQuery.extend(jQuery.fn, {\n I don´t know how to fix this issue an had already added the jquery-1.3.2.js to my scripts, there is the valdiation code I'm using: script type=text/javascript src=../../Scripts/ jquery.validate.js/script script type=text/javascript src=../../Scripts/ jquery-1.3.2.js/script script type=text/javascript $(document).ready(function(){ $(#simpleSignUp).validate(); }); /script form id=simpleSignUpForm action= method=get input type=text id=firstname class=required minlength=2/ input type=text id=lastname class=required minlength=2/ input type=text id=username class=required minlength=2/ input type=text id=email class=required email minlength=2/ input type=text id=password class=required minlength=8 / input type=text id=website class=url / input type=submit value=Submit / /form Any help will be very appreciate, Thanks in advance... -- Thanks, Anoop
[jQuery] Basic questions about jQuery validation plugin.
Hello, I have a form with a set of input fields. I am going to validate the form with jQuery Validation. The field has the value of its ID different from the value of its name. I've looked around and tried several times with the form validate method. But, it seems like the validation got trigged only if the id and the name have the same value. But I want to keep the input fields that way. My validation function is simple. $(document).ready(function() { $('#myform').validate({ rules: { score_1 : {required: true} }); }) My input's input id=score_1 type=text name=score[1] / input id=score_2 type=text name=score[2] / input id=score_3 type=text name=score[3] / The validate is not trigged in this way. Can you help me on this? Thank you. Leon
[jQuery] Re: Basic questions about jQuery validation plugin.
I think the validation plugin depends only on the name and not the id. On 7/29/09, Leon leon...@gmail.com wrote: Hello, I have a form with a set of input fields. I am going to validate the form with jQuery Validation. The field has the value of its ID different from the value of its name. I've looked around and tried several times with the form validate method. But, it seems like the validation got trigged only if the id and the name have the same value. But I want to keep the input fields that way. My validation function is simple. $(document).ready(function() { $('#myform').validate({ rules: { score_1 : {required: true} }); }) My input's input id=score_1 type=text name=score[1] / input id=score_2 type=text name=score[2] / input id=score_3 type=text name=score[3] / The validate is not trigged in this way. Can you help me on this? Thank you. Leon -- Thanks, Anoop
[jQuery] Re: Basic questions about jQuery validation plugin.
Also, you might have a missing curly-bracket after rules: { score_1 : {required: true} unless you just mis-typed it. Tim :o] On Jul 30, 7:57 am, Anoop kumar V anoopkum...@gmail.com wrote: I think the validation plugin depends only on the name and not the id. On 7/29/09, Leon leon...@gmail.com wrote: Hello, I have a form with a set of input fields. I am going to validate the form with jQuery Validation. The field has the value of its ID different from the value of its name. I've looked around and tried several times with the form validate method. But, it seems like the validation got trigged only if the id and the name have the same value. But I want to keep the input fields that way. My validation function is simple. $(document).ready(function() { $('#myform').validate({ rules: { score_1 : {required: true} }); }) My input's input id=score_1 type=text name=score[1] / input id=score_2 type=text name=score[2] / input id=score_3 type=text name=score[3] / The validate is not trigged in this way. Can you help me on this? Thank you. Leon -- Thanks, Anoop
[jQuery] Re: Basic questions about jQuery validation plugin.
I belive it should be like this: (added messages for you if you arean't using them) $('#myform').validate({ rules: { score_1 : {required: true}, score_2 : {required: true}, score_3 : {required: true} } messages: { score_1 : Required message here, score_2 : Required message here, score_3 : Required message here } }); }); On Jul 30, 9:04 am, Tim tberne...@mchsi.com wrote: Also, you might have a missing curly-bracket after rules: { score_1 : {required: true} unless you just mis-typed it. Tim :o] On Jul 30, 7:57 am, Anoop kumar V anoopkum...@gmail.com wrote: I think the validation plugin depends only on the name and not the id. On 7/29/09, Leon leon...@gmail.com wrote: Hello, I have a form with a set of input fields. I am going to validate the form with jQuery Validation. The field has the value of its ID different from the value of its name. I've looked around and tried several times with the form validate method. But, it seems like the validation got trigged only if the id and the name have the same value. But I want to keep the input fields that way. My validation function is simple. $(document).ready(function() { $('#myform').validate({ rules: { score_1 : {required: true} }); }) My input's input id=score_1 type=text name=score[1] / input id=score_2 type=text name=score[2] / input id=score_3 type=text name=score[3] / The validate is not trigged in this way. Can you help me on this? Thank you. Leon -- Thanks, Anoop- Hide quoted text - - Show quoted text -
[jQuery] jQuery Validation Plugin jQuery Form Plugin
Validation plug-in version: 1.5.5 Form plug-in version: 2.28 I was able to get the validation and submit to work together properly. However, when using options in the validation plugin such as errorClass and validClass I was ran into some trouble. Upon submission, these classes would stick/stay. The form data is cleared properly when using the clearform: true option association with the form plug-in. Here is a little more detail. Upon validating I was filling in the input fields' background with a light green color to show the user that this field was indeed valid and they could proceed to submit. This worked fine until submission. The form data would clear properly but the options associated with validation would stay. Is there anyway to clear all the validation options on submit? Thanks in advance!
[jQuery] Validation plugin - submit form without validation
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] Validation Plugin
Recently I have just started using JQuery and JQuery Validation plugin. They are really great in terms of helping me in my project. I am having problem with one of the property in the validation plugin. I do not understand about the method called Remote. How do I write out a script in JSP to process the field at my server?? Can anyone show me an example? Thank you very much
[jQuery] [validation plugin] Label disappears on validation
Hi, Let me describe the problem I have to solve : When a field is unvalid : its label gets the errorClass class. Allright ! When the field gets valid : the label, instead of only loosing the error class, completely disappears (style=display: none;). How can I keep my labels displayed when the validation is OK ? I described this as a bug (http://plugins.jquery.com/node/8592), I have been answered : Adding the errorClass to the regular element doesn't work - the plugin uses the errorClass to find the label to show/hide. Use a different class (with the same styles) to fix this. I understood I had to specify an errorClass, but it doesn't solve the problem. Any idea ? Ypy - Here is the source code used : jQuery.extend(jQuery.validator.messages, { // quand le champ est invalide email: Veuillez entrer une adresse email valide., }); $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#formulaire).validate({ rules: { Nom: required, Email: { required: true, email: true, }, }, errorClass: champrequisvide, errorContainer: #messageChampsManquants, // classe à appliquer pour les champs manquants et leurs labels highlight: function(element, errorClass) { $(element).addClass(errorClass); $(element.form).find(label[for= + element.id + ]).addClass (errorClass); }, unhighlight: function(element, errorClass) { $(element).removeClass(errorClass); $(element.form).find(label[for= + element.id + ]).removeClass (errorClass); }, }); }); PS : It seems it has been solved there (at least for select fields, doesn't work for text inputs): http://groups.google.com/group/jquery-en/browse_thread/thread/d643212792...
[jQuery] jquery validation plugin. Need help with passing variable to jQuery.format
I'm having some troubles with passing variables to jQuery.format I have a script (php) that's checks if the domain part exists. If not it will show an message The following code works #1 It split an email address and assigns the domain name to the var hostName $(document).ready(function() { var x = $('#email').val(); var ind=x.indexOf(@); var hostName=x.slice((ind+1),x.length); rest of script it will correctly show the var hostName in jQuery.format, but after entering another incorrect domain name it will show the first incorrect domain name I've also tried this #2 $(document).ready(function() { $(#email).blur(function () { var x = $('#email').val(); var ind=x.indexOf(@); var hostName=x.slice((ind+1),x.length); }).blur(); ...rest of script But then i got a message (firebug) that hostName is not defined #3 $(document).ready(function() { $(#email).blur(function () { var x = $('#email').val(); var ind=x.indexOf(@); var hostName=x.slice((ind+1),x.length); alert(hostName); }).blur(); .. rest of script This will show the domain name, but on loading page it will show an empty alert window I prefer method #2. How can i pass the var hostName to jQuery.format? Any help is much appreciated.
[jQuery] Re: jquery validation plugin. Need help with passing variable to jQuery.format
On 5 jun, 12:11, talisien globalnewsgrab...@gmail.com wrote: I'm having some troubles with passing variables to jQuery.format I have a script (php) that's checks if the domain part exists. If not it will show an message The following code works #1 It split an email address and assigns the domain name to the var hostName $(document).ready(function() { var x = $('#email').val(); var ind=x.indexOf(@); var hostName=x.slice((ind+1),x.length); rest of script it will correctly show the var hostName in jQuery.format, but after entering another incorrect domain name it will show the first incorrect domain name I've also tried this #2 $(document).ready(function() { $(#email).blur(function () { var x = $('#email').val(); var ind=x.indexOf(@); var hostName=x.slice((ind+1),x.length); }).blur(); ...rest of script But then i got a message (firebug) that hostName is not defined #3 $(document).ready(function() { $(#email).blur(function () { var x = $('#email').val(); var ind=x.indexOf(@); var hostName=x.slice((ind+1),x.length); alert(hostName);}).blur(); .. rest of script This will show the domain name, but on loading page it will show an empty alert window I prefer method #2. How can i pass the var hostName to jQuery.format? Any help is much appreciated. update: method #1 requires an refresh to show hostName
[jQuery] Re: jQuery Validation Plugin
Man i combed the docs for a day, and i missed that link everytime.. Thanks Jorn. On May 23, 3:02 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You need to quote the full key, eg name['name']: required. Seehttp://docs.jquery.com/Plugins/Validation#Fields_with_complex_names_ Jörn On Fri, May 22, 2009 at 10:15 PM, Bob O bhan...@hcinsight.com wrote: so as not to confuse.. the name attribute looks like this name=name['name'] for the input field and the js is rules: { name['name']: 'required' } i noticed typos in the above question. On May 22, 12:36 pm, bhan...@hcinsight.com bhan...@hcinsight.com wrote: Can anyone tell me how i can change which attribute on my form field triggers the validation? currently it appears the be the name attribute. So in my Rails app using Rails helpers, it sets the name to somthing like formname ['fieldname'] and the whole name. in my script if i do something like rules: { formname['fieldname]: 'required' } etcit causes the script to break. I need a workaround if anyone has ever come across this problem.. Thanks in Advance
[jQuery] Re: jQuery Validation Plugin
A testpage would help. Can't see anything wrong with that code. Jörn On Tue, May 26, 2009 at 4:13 PM, Bob O bhan...@hcinsight.com wrote: So it seems im still having some issues.. this is my html form id=new_blog_post class=new_blog_post method=post action=/ blog_posts p label for=blog_post_titleTitle/label br/ input id=blog_post_title type=text size=30 name=blog_post [title]/ /p p label for=blog_post_bodyBody/label br/ textarea id=blog_post_body rows=5 name=blog_post[body] cols=28/ /p p label for=blog_post_authorAuthor/label br/ input id=blog_post_author type=text size=30 name=blog_post [author]/ /p p label for=blog_post_permalinkPermalink/label span class=small_textA hyphen separated title for URL's e.g. my- title/span br/ input id=blog_post_permalink type=text size=30 name=blog_post [permalink]/ /p p input id=blog_post_submit class=btn type=submit value=Submit name=commit/ /p /form and this is my js placed after the jQuery and jquery.validate scripts. $(document).ready(function() { $('#new_blog_post').validate({ rules: { blog_post[title]: required, blog_post[body]: required, blog_post[author]: required }, messages: { blog_post[title]: You must enter a title., blog_post[body]: You cant have a blog without a blog..?, blog_post[author]: You must supplay an author name } }); }); Any ideas? On May 26, 7:48 am, Bob O bhan...@hcinsight.com wrote: Man i combed the docs for a day, and i missed that link everytime.. Thanks Jorn. On May 23, 3:02 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You need to quote the full key, eg name['name']: required. Seehttp://docs.jquery.com/Plugins/Validation#Fields_with_complex_names_ Jörn On Fri, May 22, 2009 at 10:15 PM, Bob O bhan...@hcinsight.com wrote: so as not to confuse.. the name attribute looks like this name=name['name'] for the input field and the js is rules: { name['name']: 'required' } i noticed typos in the above question. On May 22, 12:36 pm, bhan...@hcinsight.com bhan...@hcinsight.com wrote: Can anyone tell me how i can change which attribute on my form field triggers the validation? currently it appears the be the name attribute. So in my Rails app using Rails helpers, it sets the name to somthing like formname ['fieldname'] and the whole name. in my script if i do something like rules: { formname['fieldname]: 'required' } etcit causes the script to break. I need a workaround if anyone has ever come across this problem.. Thanks in Advance
[jQuery] Re: jQuery Validation Plugin
Hi Bob, Its working fine.. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head titleUntitled Page/title script type =text/javascript src=jquery-1.3.2-vsdoc2.js /script script type=text/javascript src=jquery-validator.js /script script type =text/javascript $(document).ready(function() { $('#new_blog_post').validate({ rules: { blog_post[title]: required, blog_post[body]: required, blog_post[author]: required }, messages: { blog_post[title]: You must enter a title., blog_post[body]: You cant have a blog without a blog..?, blog_post[author]: You must supplay an author name } }); }); /script /head body form id=new_blog_post class=new_blog_post method=post action=/blog_posts p label for=blog_post_titleTitle/label br/ input id=blog_post_title type=text size=30 name=blog_post[title]/ /p p label for=blog_post_bodyBody/label br/ textarea id=blog_post_body rows=5 name=blog_post[body] cols=28/textarea /p p label for=blog_post_authorAuthor/label br/ input id=blog_post_author type=text size=30 name=blog_post[author]/ /p p label for=blog_post_permalinkPermalink/label span class=small_textA hyphen separated title for URL's e.g. my-title/span br/ input id=blog_post_permalink type=text size=30 name=blog_post[permalink]/ /p p input id=blog_post_submit class=btn type=submit value=Submit name=commit/ /p /form /body /html 2009/5/26 Bob O bhan...@hcinsight.com So it seems im still having some issues.. this is my html form id=new_blog_post class=new_blog_post method=post action=/ blog_posts p label for=blog_post_titleTitle/label br/ input id=blog_post_title type=text size=30 name=blog_post [title]/ /p p label for=blog_post_bodyBody/label br/ textarea id=blog_post_body rows=5 name=blog_post[body] cols=28/ /p p label for=blog_post_authorAuthor/label br/ input id=blog_post_author type=text size=30 name=blog_post [author]/ /p p label for=blog_post_permalinkPermalink/label span class=small_textA hyphen separated title for URL's e.g. my- title/span br/ input id=blog_post_permalink type=text size=30 name=blog_post [permalink]/ /p p input id=blog_post_submit class=btn type=submit value=Submit name=commit/ /p /form and this is my js placed after the jQuery and jquery.validate scripts. $(document).ready(function() { $('#new_blog_post').validate({ rules: { blog_post[title]: required, blog_post[body]: required, blog_post[author]: required }, messages: { blog_post[title]: You must enter a title., blog_post[body]: You cant have a blog without a blog..?, blog_post[author]: You must supplay an author name } }); }); Any ideas? On May 26, 7:48 am, Bob O bhan...@hcinsight.com wrote: Man i combed the docs for a day, and i missed that link everytime.. Thanks Jorn. On May 23, 3:02 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You need to quote the full key, eg name['name']: required. Seehttp://docs.jquery.com/Plugins/Validation#Fields_with_complex_names_.. .. Jörn On Fri, May 22, 2009 at 10:15 PM, Bob O bhan...@hcinsight.com wrote: so as not to confuse.. the name attribute looks like this name=name['name'] for the input field and the js is rules: { name['name']: 'required' } i noticed typos in the above question. On May 22, 12:36 pm, bhan...@hcinsight.com bhan...@hcinsight.com wrote: Can anyone tell me how i can change which attribute on my form field triggers the validation? currently it appears the be the name attribute. So in my Rails app using Rails helpers, it sets the name to somthing like formname ['fieldname'] and the whole name. in my script if i do something like rules: { formname['fieldname]: 'required' } etcit causes the script to break. I need a workaround if anyone has ever come across this problem.. Thanks in Advance
[jQuery] Re: How to go to top of page after form validation fails (using jQuery validation plugin)
Hi folks, I found the answer: scroll(0,0); In my code, I put this line right after the code to generate the error message at the top of the page telling how many total errors there are. Hope this is helpful to someone. Kathryn On Mar 31, 6:05 pm, Kathryn kathry...@gmail.com wrote: I'm using the validation plugin athttp://bassistance.de. When form validation fails, focus goes to the first invalid element. But I have a summary error message at the top of the page which I want the user to see. If the first invalid field is too far down, they don't see the message. How can I go to the top of the page after validation fails? (Seems like this should be easy, but googling didn't reveal an answer.) Thanks in advance-- Kathryn
[jQuery] Re: jQuery Validation Plugin
You need to quote the full key, eg name['name']: required. See http://docs.jquery.com/Plugins/Validation#Fields_with_complex_names_.28brackets.2C_dots.29 Jörn On Fri, May 22, 2009 at 10:15 PM, Bob O bhan...@hcinsight.com wrote: so as not to confuse.. the name attribute looks like this name=name['name'] for the input field and the js is rules: { name['name']: 'required' } i noticed typos in the above question. On May 22, 12:36 pm, bhan...@hcinsight.com bhan...@hcinsight.com wrote: Can anyone tell me how i can change which attribute on my form field triggers the validation? currently it appears the be the name attribute. So in my Rails app using Rails helpers, it sets the name to somthing like formname ['fieldname'] and the whole name. in my script if i do something like rules: { formname['fieldname]: 'required' } etcit causes the script to break. I need a workaround if anyone has ever come across this problem.. Thanks in Advance
[jQuery] jQuery Validation Plugin
Can anyone tell me how i can change which attribute on my form field triggers the validation? currently it appears the be the name attribute. So in my Rails app using Rails helpers, it sets the name to somthing like formname ['fieldname'] and the whole name. in my script if i do something like rules: { formname['fieldname]: 'required' } etcit causes the script to break. I need a workaround if anyone has ever come across this problem.. Thanks in Advance
[jQuery] Re: jQuery Validation Plugin
so as not to confuse.. the name attribute looks like this name=name['name'] for the input field and the js is rules: { name['name']: 'required' } i noticed typos in the above question. On May 22, 12:36 pm, bhan...@hcinsight.com bhan...@hcinsight.com wrote: Can anyone tell me how i can change which attribute on my form field triggers the validation? currently it appears the be the name attribute. So in my Rails app using Rails helpers, it sets the name to somthing like formname ['fieldname'] and the whole name. in my script if i do something like rules: { formname['fieldname]: 'required' } etcit causes the script to break. I need a workaround if anyone has ever come across this problem.. Thanks in Advance
[jQuery] Re: JQuery Validation plugin with Django (New) Forms (V1.0) - Are these compatible?
Jon - Good catch - however that was just a cut/paste problem - below is a new example that does not work as expected - for some reason the validation errors are ignored and the form is posted - not what I was expecting. Is there something else I need to do to prevent form from posting on errors? Why would the validation errors get ignored? Any ideas? TIA !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/ js/jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/ js/jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { subject: required, email:{ required: true, email: true } }, messages: { subject: Enter subject info, email: Enter email info, } }); }); /script /head body div id=main div style=clear: both;/div /div div class=content body bgcolor=#D2FFD2 img src=/media/images/Masthead.png width=942 height=162 form method=post action= id=contact-us h3 Django/JQuery Demo - Get Request /h3 table trthlabel for=id_subjectSubject:/label/ thtdinput id=id_subject type=text name=subject maxlength=100 //td/tr trthlabel for=id_emailEmail:/label/thtdinput id=id_email type=text name=email maxlength=100 //td/tr trthlabel for=id_msgtextText:/label/thtdtextarea id=id_msgtext rows=10 cols=40 name=msgtext/textarea/td/ tr tr td/td td div class=submit input type=submit value=Submit value=update / /div/td /tr /table /form /div /body /html On May 5, 10:35 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You define rules for a field sender, but there is no input with name=sender. Jörn On Tue, May 5, 2009 at 7:28 PM, BrendanC bren...@gmail.com wrote: JQuery newbie question re using validation plugin with Django newform. I have a simple email feedback contact django form that I wanted to enhance with some JQuery validation. I created a standalone (Non Django) version of the form and it works correctly. However when I create a Django version of the form the validation rules seems to be ignored and the form is always posted - I would expect the form to fail, and never post. One difference (not sure if it's siignificant) is that the Django forms are created from classes/ templates and render as tables. However the exact same HTML code works for the basic form. I'm now thinking that there must be something different re how the submit is being processed for the Django form - but I'm stumped. Anyone got any ideas/things to try? TIA, Brendan Below is a simplified code (both Basic and Djange versions) sample stripped to one validation field: Basic version of the form (working): !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/js/ jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/js/ jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title link href=/media/css/default.css media=screen type=text/css rel=stylesheet style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { sender: required, minlength:4 }, messages: { sender: Enter sender's name, } }); return false; }); /script /head body div id=main div style=clear: both;/div /div div class=content body bgcolor=#D2FFD2 img
[jQuery] Re: JQuery Validation plugin with Django (New) Forms (V1.0) - Are these compatible?
You can set debug:true for debugging. It will always prevent the form submit, which is useful to look at errors that are thrown during validation. Jörn On Wed, May 6, 2009 at 8:37 PM, BrendanC bren...@gmail.com wrote: Jon - Good catch - however that was just a cut/paste problem - below is a new example that does not work as expected - for some reason the validation errors are ignored and the form is posted - not what I was expecting. Is there something else I need to do to prevent form from posting on errors? Why would the validation errors get ignored? Any ideas? TIA !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/ js/jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/ js/jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { subject: required, email:{ required: true, email: true } }, messages: { subject: Enter subject info, email: Enter email info, } }); }); /script /head body div id=main div style=clear: both;/div /div div class=content body bgcolor=#D2FFD2 img src=/media/images/Masthead.png width=942 height=162 form method=post action= id=contact-us h3 Django/JQuery Demo - Get Request /h3 table trthlabel for=id_subjectSubject:/label/ thtdinput id=id_subject type=text name=subject maxlength=100 //td/tr trthlabel for=id_emailEmail:/label/thtdinput id=id_email type=text name=email maxlength=100 //td/tr trthlabel for=id_msgtextText:/label/thtdtextarea id=id_msgtext rows=10 cols=40 name=msgtext/textarea/td/ tr tr td/td td div class=submit input type=submit value=Submit value=update / /div/td /tr /table /form /div /body /html On May 5, 10:35 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You define rules for a field sender, but there is no input with name=sender. Jörn On Tue, May 5, 2009 at 7:28 PM, BrendanC bren...@gmail.com wrote: JQuery newbie question re using validation plugin with Django newform. I have a simple email feedback contact django form that I wanted to enhance with some JQuery validation. I created a standalone (Non Django) version of the form and it works correctly. However when I create a Django version of the form the validation rules seems to be ignored and the form is always posted - I would expect the form to fail, and never post. One difference (not sure if it's siignificant) is that the Django forms are created from classes/ templates and render as tables. However the exact same HTML code works for the basic form. I'm now thinking that there must be something different re how the submit is being processed for the Django form - but I'm stumped. Anyone got any ideas/things to try? TIA, Brendan Below is a simplified code (both Basic and Djange versions) sample stripped to one validation field: Basic version of the form (working): !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/js/ jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/js/ jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title link href=/media/css/default.css media=screen type=text/css rel=stylesheet style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { sender: required, minlength:4 }, messages: {
[jQuery] Re: JQuery Validation plugin with Django (New) Forms (V1.0) - Are these compatible?
Jorn - thanks for the responses - I resolved my problem - for the record I had a mismatch between the versions of JQuery (1.3.2) and an earlier (incompatible) version of the plugin. This was causing some errors that I managed to track down with Firebug. Downloaded the new version of the validation plugin and the behaviour is now what I expect. So it looks like this is nothing to do with Django. Hope this helps someone else in the future. Brendan On May 6, 2:47 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You can set debug:true for debugging. It will always prevent the form submit, which is useful to look at errors that are thrown during validation. Jörn On Wed, May 6, 2009 at 8:37 PM, BrendanC bren...@gmail.com wrote: Jon - Good catch - however that was just a cut/paste problem - below is a new example that does not work as expected - for some reason the validation errors are ignored and the form is posted - not what I was expecting. Is there something else I need to do to prevent form from posting on errors? Why would the validation errors get ignored? Any ideas? TIA !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/ js/jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/ js/jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { subject: required, email:{ required: true, email: true } }, messages: { subject: Enter subject info, email: Enter email info, } }); }); /script /head body div id=main div style=clear: both;/div /div div class=content body bgcolor=#D2FFD2 img src=/media/images/Masthead.png width=942 height=162 form method=post action= id=contact-us h3 Django/JQuery Demo - Get Request /h3 table trthlabel for=id_subjectSubject:/label/ thtdinput id=id_subject type=text name=subject maxlength=100 //td/tr trthlabel for=id_emailEmail:/label/thtdinput id=id_email type=text name=email maxlength=100 //td/tr trthlabel for=id_msgtextText:/label/thtdtextarea id=id_msgtext rows=10 cols=40 name=msgtext/textarea/td/ tr tr td/td td div class=submit input type=submit value=Submit value=update / /div/td /tr /table /form /div /body /html On May 5, 10:35 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You define rules for a field sender, but there is no input with name=sender. Jörn On Tue, May 5, 2009 at 7:28 PM, BrendanC bren...@gmail.com wrote: JQuery newbie question re using validation plugin with Django newform. I have a simple email feedback contact django form that I wanted to enhance with some JQuery validation. I created a standalone (Non Django) version of the form and it works correctly. However when I create a Django version of the form the validation rules seems to be ignored and the form is always posted - I would expect the form to fail, and never post. One difference (not sure if it's siignificant) is that the Django forms are created from classes/ templates and render as tables. However the exact same HTML code works for the basic form. I'm now thinking that there must be something different re how the submit is being processed for the Django form - but I'm stumped. Anyone got any ideas/things to try? TIA, Brendan Below is a simplified code (both Basic and Djange versions) sample stripped to one validation field: Basic version of the form (working): !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/js/ jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/js/ jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html;
[jQuery] JQuery Validation plugin with Django (New) Forms (V1.0) - Are these compatible?
JQuery newbie question re using validation plugin with Django newform. I have a simple email feedback contact django form that I wanted to enhance with some JQuery validation. I created a standalone (Non Django) version of the form and it works correctly. However when I create a Django version of the form the validation rules seems to be ignored and the form is always posted - I would expect the form to fail, and never post. One difference (not sure if it's siignificant) is that the Django forms are created from classes/ templates and render as tables. However the exact same HTML code works for the basic form. I'm now thinking that there must be something different re how the submit is being processed for the Django form - but I'm stumped. Anyone got any ideas/things to try? TIA, Brendan Below is a simplified code (both Basic and Djange versions) sample stripped to one validation field: Basic version of the form (working): !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/js/ jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/js/ jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title link href=/media/css/default.css media=screen type=text/css rel=stylesheet style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { sender: required, minlength:4 }, messages: { sender: Enter sender's name, } }); return false; }); /script /head body div id=main div style=clear: both;/div /div div class=content body bgcolor=#D2FFD2 img src=/media/images/Masthead.png width=942 height=162 form method=post action= id=contact-us {% block content %} h3 {{ message }} /h3 table {{ eForm }} tr td/td td div class=submit input type=submit value=Submit value=update / /div/td /tr /table {% endblock %} /form /div /body Django version of the form below (validation not working): !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/js/ jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/js/ jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title link href=/media/css/default.css media=screen type=text/css rel=stylesheet style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { sender: required, minlength:4 }, messages: { sender: Enter sender's name, } }); return false; }); /script /head body div id=main div style=clear: both;/div /div div class=content body bgcolor=#D2FFD2 img src=/media/images/Masthead.png width=942 height=162 form method=post action= id=contact-us h3 Django/JQuery Demo - Get Request /h3 table trthlabel for=id_subjectSubject:/label/thtdinput id=id_subject type=text name=subject maxlength=100 //td/ tr trthlabel for=id_emailEmail:/label/thtdinput id=id_email type=text name=email maxlength=100 //td/tr trthlabel for=id_msgtextText:/label/thtdtextarea id=id_msgtext rows=10 cols=40 name=msgtext/textarea/td/ tr tr td/td td div class=submit input
[jQuery] Re: JQuery Validation plugin with Django (New) Forms (V1.0) - Are these compatible?
You define rules for a field sender, but there is no input with name=sender. Jörn On Tue, May 5, 2009 at 7:28 PM, BrendanC bren...@gmail.com wrote: JQuery newbie question re using validation plugin with Django newform. I have a simple email feedback contact django form that I wanted to enhance with some JQuery validation. I created a standalone (Non Django) version of the form and it works correctly. However when I create a Django version of the form the validation rules seems to be ignored and the form is always posted - I would expect the form to fail, and never post. One difference (not sure if it's siignificant) is that the Django forms are created from classes/ templates and render as tables. However the exact same HTML code works for the basic form. I'm now thinking that there must be something different re how the submit is being processed for the Django form - but I'm stumped. Anyone got any ideas/things to try? TIA, Brendan Below is a simplified code (both Basic and Djange versions) sample stripped to one validation field: Basic version of the form (working): !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/js/ jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/js/ jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title link href=/media/css/default.css media=screen type=text/css rel=stylesheet style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { sender: required, minlength:4 }, messages: { sender: Enter sender's name, } }); return false; }); /script /head body div id=main div style=clear: both;/div /div div class=content body bgcolor=#D2FFD2 img src=/media/images/Masthead.png width=942 height=162 form method=post action= id=contact-us {% block content %} h3 {{ message }} /h3 table {{ eForm }} tr td/td td div class=submit input type=submit value=Submit value=update / /div/td /tr /table {% endblock %} /form /div /body Django version of the form below (validation not working): !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/js/ jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/js/ jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title link href=/media/css/default.css media=screen type=text/css rel=stylesheet style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { sender: required, minlength:4 }, messages: { sender: Enter sender's name, } }); return false; }); /script /head body div id=main div style=clear: both;/div /div div class=content body bgcolor=#D2FFD2 img src=/media/images/Masthead.png width=942 height=162 form method=post action= id=contact-us h3 Django/JQuery Demo - Get Request /h3 table trthlabel for=id_subjectSubject:/label/thtdinput id=id_subject type=text name=subject maxlength=100 //td/ tr trthlabel for=id_emailEmail:/label/thtdinput id=id_email type=text name=email maxlength=100 //td/tr trthlabel
[jQuery] jQuery Validation Plugin - rule metadata documentation?
Are the options, usage and limitations for the jQuery Validation rules using metadata in markup, e.g., class=required date, documented anywhere? There is http://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation_methods, but that is for setting up rules in the JS.
[jQuery] Re: jQuery Validation Plugin - rule metadata documentation?
The list applies to metadata as well. You can specify any method as an attribute, and where there are no parameters needed, use a class instead. Jörn On Thu, Apr 23, 2009 at 9:49 PM, Brad nrmlcrpt...@gmail.com wrote: Are the options, usage and limitations for the jQuery Validation rules using metadata in markup, e.g., class=required date, documented anywhere? There is http://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation_methods, but that is for setting up rules in the JS.
[jQuery] Re: jQuery Validation Plugin - rule metadata documentation?
Thanks Jorn. Since I wrote I've been looking at the additional- methods.js to get ideas on how to write some custom filter and found this example: class={required:true,vinUS:true} Is that object syntax required when using custom filters as opposed to simply class=required vinUS? re: where no parameters are needed I assume you can't do something like this: class=required:true,minlength:2? On Apr 23, 1:57 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: The list applies to metadata as well. You can specify any method as an attribute, and where there are no parameters needed, use a class instead. Jörn On Thu, Apr 23, 2009 at 9:49 PM, Brad nrmlcrpt...@gmail.com wrote: Are the options, usage and limitations for the jQuery Validation rules using metadata in markup, e.g., class=required date, documented anywhere? There ishttp://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation..., but that is for setting up rules in the JS.
[jQuery] Re: jQuery Validation Plugin - rule metadata documentation?
This requires the metadata plugin: class={required:true,vinUS:true} This doesn't: class=required vinUS minlength=2 Jörn On Thu, Apr 23, 2009 at 10:09 PM, Brad nrmlcrpt...@gmail.com wrote: Thanks Jorn. Since I wrote I've been looking at the additional- methods.js to get ideas on how to write some custom filter and found this example: class={required:true,vinUS:true} Is that object syntax required when using custom filters as opposed to simply class=required vinUS? re: where no parameters are needed I assume you can't do something like this: class=required:true,minlength:2? On Apr 23, 1:57 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: The list applies to metadata as well. You can specify any method as an attribute, and where there are no parameters needed, use a class instead. Jörn On Thu, Apr 23, 2009 at 9:49 PM, Brad nrmlcrpt...@gmail.com wrote: Are the options, usage and limitations for the jQuery Validation rules using metadata in markup, e.g., class=required date, documented anywhere? There ishttp://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation..., but that is for setting up rules in the JS.
[jQuery] Validation plugin - Using with 'button' buttons?
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] Validation plugin (bassistance.de) problem
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] min file for jQuery Validation Plugin
Ok, obviously we know what a min file is. But can someone tell me for the jQuery plugin what does this min file restrict you from or strip out from the main? What is filtered out? I need to know what I'm getting or not getting compared to the main jQuery Validation .js library. http://bassistance.de/jquery-plugins/jquery-plugin-validation/
[jQuery] Re: min file for jQuery Validation Plugin
minified files are just whitespace and line breaks removed, and object names are shortened. Nevermind. On Apr 14, 4:49 pm, expresso dschin...@gmail.com wrote: Ok, obviously we know what a min file is. But can someone tell me for the jQuery plugin what does this min file restrict you from or strip out from the main? What is filtered out? I need to know what I'm getting or not getting compared to the main jQuery Validation .js library. http://bassistance.de/jquery-plugins/jquery-plugin-validation/
[jQuery] Re: Custom error function in jQuery Validation plugin?
Can someone help pls Thanks!! On Apr 12, 12:32 pm, cohq82 quang...@gmail.com wrote: I am new to jQuery validation plugin (http://docs.jquery.com/Plugins/ Validation). What I am trying to do is to have my own error message DIV with display:none initially. If there is error, I want to run the fadein/fadeout to show that error. The structure of the input/error DIV like this: divinput/input/div divcontext help/div diverror msg/div The way this plugin works is to insert a LABEL right next to the INPUT and this is not what I want. I want to reuse the html code I have in the error msg DIV. I tried to look in errorPlacement but not sure how to use it. Can someone help? Thanks
[jQuery] username validation using jQuery Validation plugin
Hi all, Is there a way to validate username field (no space, only letters)? I don't want to modify the code. I know this can be done easily with if statement but I just want to see if the Validation plugin has this feature already: http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js Thanks.
[jQuery] Custom error function in jQuery Validation plugin?
I am new to jQuery validation plugin (http://docs.jquery.com/Plugins/ Validation). What I am trying to do is to have my own error message DIV with display:none initially. If there is error, I want to run the fadein/fadeout to show that error. The structure of the input/error DIV like this: divinput/input/div divcontext help/div diverror msg/div The way this plugin works is to insert a LABEL right next to the INPUT and this is not what I want. I want to reuse the html code I have in the error msg DIV. I tried to look in errorPlacement but not sure how to use it. Can someone help? Thanks
[jQuery] Validation plugin remote problem
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] validation plugin question
Can this plugin be used when there is no actual submit, just redirect via a tag. However before doing redirect I need to make sure that value entered in the filed is valid?
[jQuery] Validation plugin (Remove the label messages)
I've started to use the validation plugin for form validation. But I don't want it to show the label error messages. I just want to change the inputs background and border color. I don't know how to disable the label messages so if someone could help me with that, that would be super.
[jQuery] jQuery Validation plugin and ASP.NET postbacks
Hi, Have anyone been able to use the jQuery validation script and been able to make the buttonclick cause a post back? The form validates fine but the post is never made. If I add the option submitHandler on the plugin it goes in there, but that does not really help as i dont want to do a ajax submit. What i want is to make the postback continue as normal if the validation is true. Anyone else manged to work around this problem? Regards, Johan
[jQuery] How to go to top of page after form validation fails (using jQuery validation plugin)
I'm using the validation plugin at http://bassistance.de. When form validation fails, focus goes to the first invalid element. But I have a summary error message at the top of the page which I want the user to see. If the first invalid field is too far down, they don't see the message. How can I go to the top of the page after validation fails? (Seems like this should be easy, but googling didn't reveal an answer.) Thanks in advance-- Kathryn
[jQuery] Re: Jquery validation plugin question
Thanks. It gives me an error saying element.attr is not a function What is wrong with this: highlight: function(element, errorClass) { if (element.attr(name) == aupairLanguageList) $(#multiSelect-aupairLanguageList-title).addClass(error); }, unhighlight: function(element, errorClass) { if (element.attr(name) == aupairLanguageList) $(#multiSelect-aupairLanguageList-title).removeClass (error); } On Mar 26, 12:03 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Use the highlight and unhighlight options for that. Jörn On Thu, Mar 26, 2009 at 3:21 PM, markstegg...@googlemail.com markstegg...@googlemail.com wrote: Hello, Thanks for building this validation plugin, I like it. I have a question: The error class automatically gets added to the label with the same for= name, but for a certain error I need to change the element that gains the error class. For instance, I added this line to the error placement so that a certain element receives the error class but then realised the error class would not be removed when the error is corrected by the user: code else if (element.attr(name) == aupairLanguageList) { error.insertAfter(#multiSelect-aupairLanguageList-content); $(#multiSelect-aupairLanguageList-title).addClass(error); } /code Any Ideas? Thanks
[jQuery] Jquery validation plugin question
Hello, Thanks for building this validation plugin, I like it. I have a question: The error class automatically gets added to the label with the same for= name, but for a certain error I need to change the element that gains the error class. For instance, I added this line to the error placement so that a certain element receives the error class but then realised the error class would not be removed when the error is corrected by the user: code else if (element.attr(name) == aupairLanguageList) { error.insertAfter(#multiSelect-aupairLanguageList-content); $(#multiSelect-aupairLanguageList-title).addClass(error); } /code Any Ideas? Thanks
[jQuery] Re: Jquery validation plugin question
Use the highlight and unhighlight options for that. Jörn On Thu, Mar 26, 2009 at 3:21 PM, markstegg...@googlemail.com markstegg...@googlemail.com wrote: Hello, Thanks for building this validation plugin, I like it. I have a question: The error class automatically gets added to the label with the same for= name, but for a certain error I need to change the element that gains the error class. For instance, I added this line to the error placement so that a certain element receives the error class but then realised the error class would not be removed when the error is corrected by the user: code else if (element.attr(name) == aupairLanguageList) { error.insertAfter(#multiSelect-aupairLanguageList-content); $(#multiSelect-aupairLanguageList-title).addClass(error); } /code Any Ideas? Thanks
[jQuery] Re: jQuery Validation Plugin ASP.NET
Zach, Try adding rules via the Validate method like so: $(document).ready(function() { $(#aspnetForm).validate({ rules: { TitleField: { minlength: 2 } } }); }); This worked for me in ASP.NET w/ master page. On Mar 23, 10:26 pm, Zach zachary.hun...@gmail.com wrote: I've tried to get this to work for the past 4 hours and I'm stuck. I've got a master page with the following scripts added. script type=text/javascript src=/RohmPortal/scripts/ jquery-1.3.2.js/script script type=text/javascript src=/RohmPortal/scripts/ jquery.validate.js/script this is the form tag on my master page form id=form1 runat=server in the HTML output of the page, it actually renders to aspnetForm. in the content page, this is what I have script type=text/javascript $().ready(function() { $('aspnetForm').validate(); $('.TitleField').rules(add, { minlength: 2 }); }); /script here is the control I'm trying to validate asp:TextBox ID=TitleField name=TitleField Width=390 Columns=30 MaxLength=100 runat=server EnableTheming=false CssClass=TitleField / here is the error I get when testing in IE7 Microsoft JScript runtime error: '$.data(...).settings' is null or not an object when I go to the debug in VS, it shows the $.data as being undefined. What am I missing, I've tried to use a id selector as well, without any luck. I've tested my selectors by changing background colors, and they alwasy work but why isn't this thing validating? I'm probably missing something simple, any help is GREATLY APPRECIATED! Thanks, Zach
[jQuery] Re: jQuery Validation Plugin ASP.NET
Hi You are not placing the # in front of the form id as jquery requires. I do that all the time!!! On Mar 24, 12:26 pm, Zach zachary.hun...@gmail.com wrote: I've tried to get this to work for the past 4 hours and I'm stuck. I've got a master page with the following scripts added. script type=text/javascript src=/RohmPortal/scripts/ jquery-1.3.2.js/script script type=text/javascript src=/RohmPortal/scripts/ jquery.validate.js/script this is the form tag on my master page form id=form1 runat=server in the HTML output of the page, it actually renders to aspnetForm. in the content page, this is what I have script type=text/javascript $().ready(function() { $('aspnetForm').validate(); $('.TitleField').rules(add, { minlength: 2 }); }); /script here is the control I'm trying to validate asp:TextBox ID=TitleField name=TitleField Width=390 Columns=30 MaxLength=100 runat=server EnableTheming=false CssClass=TitleField / here is the error I get when testing in IE7 Microsoft JScript runtime error: '$.data(...).settings' is null or not an object when I go to the debug in VS, it shows the $.data as being undefined. What am I missing, I've tried to use a id selector as well, without any luck. I've tested my selectors by changing background colors, and they alwasy work but why isn't this thing validating? I'm probably missing something simple, any help is GREATLY APPRECIATED! Thanks, Zach
[jQuery] jQuery Validation Plugin ASP.NET
I've tried to get this to work for the past 4 hours and I'm stuck. I've got a master page with the following scripts added. script type=text/javascript src=/RohmPortal/scripts/ jquery-1.3.2.js/script script type=text/javascript src=/RohmPortal/scripts/ jquery.validate.js/script this is the form tag on my master page form id=form1 runat=server in the HTML output of the page, it actually renders to aspnetForm. in the content page, this is what I have script type=text/javascript $().ready(function() { $('aspnetForm').validate(); $('.TitleField').rules(add, { minlength: 2 }); }); /script here is the control I'm trying to validate asp:TextBox ID=TitleField name=TitleField Width=390 Columns=30 MaxLength=100 runat=server EnableTheming=false CssClass=TitleField / here is the error I get when testing in IE7 Microsoft JScript runtime error: '$.data(...).settings' is null or not an object when I go to the debug in VS, it shows the $.data as being undefined. What am I missing, I've tried to use a id selector as well, without any luck. I've tested my selectors by changing background colors, and they alwasy work but why isn't this thing validating? I'm probably missing something simple, any help is GREATLY APPRECIATED! Thanks, Zach
[jQuery] jQuery validation plugin -- how to validate an input only if it contains info
Hi -- I've got a contact form here http://www.dianlofton.com/contact.shtml ...using the jquery.validate.js plugin. The form has an optional input for a phone number, which I'd like to have validated -- but only if there is info in the input. If you look at the source code for that page, you'll see some commented out code for the phone number validation. However, when this scripting is active on the page, it makes the phone number a required field, which is not what I'm after: $.validator.addMethod(phone, function(ph, element) { if (ph == null) { return false; } var stripped = ph.replace(/[\s()+-]|ext\.?/gi, ); // 10 is the minimum number of numbers required return ((/\d{10,}/i).test(stripped)); }, Please enter a valid phone number); Any help on how to have this field be optional, but still get validated if the user inputs data, would be greatly appreciated. Thanks! --Carl.
[jQuery] Re: jQuery validation plugin -- how to validate an input only if it contains info
Thank you! --Carl. On Mar 11, 7:54 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: add if (this.optional(element)) return true; to the top. See any existing validation method for an example, orhttp://docs.jquery.com/Plugins/Validation/Validator/addMethod Jörn On Wed, Mar 11, 2009 at 12:43 PM, clorentzen carl.lorent...@gmail.com wrote: Hi -- I've got a contact form here http://www.dianlofton.com/contact.shtml ...using the jquery.validate.js plugin. The form has an optional input for a phone number, which I'd like to have validated -- but only if there is info in the input. If you look at the source code for that page, you'll see some commented out code for the phone number validation. However, when this scripting is active on the page, it makes the phone number a required field, which is not what I'm after: $.validator.addMethod(phone, function(ph, element) { if (ph == null) { return false; } var stripped = ph.replace(/[\s()+-]|ext\.?/gi, ); // 10 is the minimum number of numbers required return ((/\d{10,}/i).test(stripped)); }, Please enter a valid phone number); Any help on how to have this field be optional, but still get validated if the user inputs data, would be greatly appreciated. Thanks! --Carl.
[jQuery] Validation Plugin: How to submit invalid form via JavaScript
Hi, I want to validate form and submit it via JavaScript even if it isn't valid, and don't do it if the submit button is pressed $(document).ready(function() { validator = $(#editUserForm).validate( { focusInvalid: false, ignoreTitle: true, onkeyup: false }); ... }); And then I'm trying to submit form after onclick on some control $(#someControl).click(function() { // do something $(#filterForm).submit(); }); Unfortunately, form doesn't via JS submit if validation failed
[jQuery] Validation Plugin: Too Much Recursion
I have an odd thing happening with the Validation Plugin (latest build on JQuery 1.3). I have several forms setup on a page, with validation on two. My first works fine, but my second keeps giving me errors in Firebug about 'too much recursion'. The configs for these two form validations are nearly identical, with the exception of the rules and messages, which are very basic field-is-requirewswwd kinda stuff. Some searching on the web shows me that there used to be a ticket on this (#2995), but that it was closed without fix. I have stripped down my second form's validate method (the one that is erroring) to the barest of validation scripts, and can not get by it for the life of me. The configs each set a validate() method on a separate form. $('#frm1').validate({ // config here } $('#frm2').validate({ // second config here } I am getting nowhere. Anyone? (BTW, I can't post the code, or show you a form, because it's all behind the firewall)
[jQuery] validation plugin: validate checkboxes that don't have same name?
using validation plugin, is there a way to validate checkbox group that has different name attributes? i would like to make sure that at least one checkbox has been selected but i'm not sure how to do it because they all have different names. thanks -- View this message in context: http://www.nabble.com/validation-plugin%3A-validate-checkboxes-that-don%27t-have-same-name--tp21865439s27240p21865439.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: [validate] Jquery validation plugin isn't working in IE
This solved it! Thanks a lot for the help Jörn! On Jan 28, 12:34 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: I'm sorry, but you have trailing commas:http://www.pluralsight.com/community/blogs/fritz/archive/2007/06/19/4... I hope its not too late :-) Jörn On Tue, Jan 27, 2009 at 11:46 PM,whttheheckerhecker.r...@gmail.com wrote: Hi, This is my first time using the validation plugin for jquery and i've got it working in firefox but when i test in IE it's not working. Here is the page:http://rickhecker.com/test/login-sign-up/index.html I'm sure it's something stupid that I'm doing because I don't see anyone else having the same problem so any help would be greatly appreciated! Thanks! p.s. the validation messages are a bit unique because it's for an alcohol related site :)
[jQuery] Validation Plugin
Hi Can some one please tell me if I can use validate plugin if saomething is written in textbox by default ? I have a textbox which is using auto complete p[lugin , so when page loads an auto-suggest keyword always written in textbox and if some user clicks that keyword,it disappears ... I want even if it is there and somebody submits the form , validation plugin should work? Thanks Varun
[jQuery] validation plugin and ui tabs
Hi Everybody I am trying to use validation plugin with ui tbas. suppose I have 5 tabs on page and every tab have submit button in that case how can I use validation plugin... I know i can use validation as: ('#form-id').validate(); but since i have 5 tabs but i cant have 5 forms in asp.net(please correct me if I am wrong)... can some one please let me know workaround for this ? Thanks Varun
[jQuery] Re: [validate] Jquery validation plugin isn't working in IE
I'm sorry, but you have trailing commas: http://www.pluralsight.com/community/blogs/fritz/archive/2007/06/19/47771.aspx I hope its not too late :-) Jörn On Tue, Jan 27, 2009 at 11:46 PM, whtthehecker hecker.r...@gmail.com wrote: Hi, This is my first time using the validation plugin for jquery and i've got it working in firefox but when i test in IE it's not working. Here is the page: http://rickhecker.com/test/login-sign-up/index.html I'm sure it's something stupid that I'm doing because I don't see anyone else having the same problem so any help would be greatly appreciated! Thanks! p.s. the validation messages are a bit unique because it's for an alcohol related site :)
[jQuery] [validate] Jquery validation plugin isn't working in IE
Hi, This is my first time using the validation plugin for jquery and i've got it working in firefox but when i test in IE it's not working. Here is the page: http://rickhecker.com/test/login-sign-up/index.html I'm sure it's something stupid that I'm doing because I don't see anyone else having the same problem so any help would be greatly appreciated! Thanks! p.s. the validation messages are a bit unique because it's for an alcohol related site :)
[jQuery] Validation Plugin: additional-methods.js
Thanks again to Jorn for a fantastic plugin. One thing I noticed, with the additional-methods.js file that is included with the download, is a small error with the messages for the maxWords, minWords, and rangeWords methods. They are missing $.format(): jQuery.validator.addMethod(maxWords, function(value, element, params) { return this.optional(element) || value.match(/\b\w+\b/g).length params; }, $.format(Please enter {0} words or less.)); jQuery.validator.addMethod(minWords, function(value, element, params) { return this.optional(element) || value.match(/\b\w+\b/g).length = params; }, $.format(Please enter at least {0} words.)); jQuery.validator.addMethod(rangeWords, function(value, element, params) { return this.optional(element) || value.match(/\b\w+\b/g).length = params[0] value.match(/bw+b/g).length params[1]; }, $.format(Please enter between {0} and {1} words.)); -- Steve Cutter Blades Adobe Certified Professional Advanced Macromedia ColdFusion MX 7 Developer _ http://blog.cutterscrossing.com --- Co-Author 'Learning Ext JS' http://www.packtpub.com/learning-ext-js/book
[jQuery] validation plugin: how to add custom messages for groups
i have a group that contains both first and last name. i'm wondering if it is possible to have custom messages for groups. i'm trying to achieve something to the following: a. if both first and last name are not filled in: First and Last name are Required b. if only first is filled in: last name is required c. if only last is filled in: first name is required is this possible? -- View this message in context: http://www.nabble.com/validation-plugin%3A-how-to-add-custom-messages-for-groups-tp21299100s27240p21299100.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] jquery validation plugin and hidden elements
Hi, I have been using a prototype form validation http://tetlaw.id.au/view/javascript/really-easy-field-validation but I now wish to go to jquery. I can get it working but there is something i can't get to work and it was the best feature of the prototype script mentione above. I would like the validation script to exclude from the process any hidden form field. I set the validation rules as metatags with class=required the following works but still requires to validate hidden fields $(#commentForm).validate(); I have tried something like.. $(#commentForm).validate({ignore: [...@type=hidden] }); but that does not work Some fields are hidden because the parent div is set to display:none when a checkbox is checked. Any ideas?
[jQuery] Re: jquery validation plugin and hidden elements
It appears that you are confusing display: none with type=hidden they are two totally different controls if you have input id=Name1 type=text class=reqired value= / and you set it to display: none when the checkbox is checked... for instance, saying $(#Name1).hide() then the selector [...@type=hidden] won't find that because it is still of type text (but just with it's display style set to none) On Dec 30, 2:26 am, nal nalbe...@gmail.com wrote: Hi, I have been using a prototype form validationhttp://tetlaw.id.au/view/javascript/really-easy-field-validation but I now wish to go to jquery. I can get it working but there is something i can't get to work and it was the best feature of the prototype script mentione above. I would like the validation script to exclude from the process any hidden form field. I set the validation rules as metatags with class=required the following works but still requires to validate hidden fields $(#commentForm).validate(); I have tried something like.. $(#commentForm).validate({ignore: [...@type=hidden] }); but that does not work Some fields are hidden because the parent div is set to display:none when a checkbox is checked. Any ideas?
[jQuery] validation plugin negative number rule?
How can I create a rule in the validation plugin to disallow negative numbers. I have a text field that should accept any number 0 thanks, A.
[jQuery] validation plugin: don't insert error element
Is there a way to instruct the validation plugin to not insert any error element?
[jQuery] validation plugin question
playing around with it. don't want to get error messages displayed. i'm just putting in a general error message at top and highlighting required fields. but the label for errors gets created with a display: inline set on the element which is thwarting me from not showing it. looking at the marketo example ( for 2 hours now ), i see no such display: inline being set but can't figure out why that is. can anyone explain?
[jQuery] help: Zend Framework and JQuery validation plugin
Hi! I try to use Zend Framework with JQuery validation plugin. Standard validation of forms works good but when I want to remote validate (f.e check a login in database) remote function dosen't work. Below I write a code with method from controller and views listing: Method from controller: function checkloginAction(){ $request = trim(strtolower($_REQUEST['login'])); //take data from global REQUEST array $users = new Users(); //make a new class with users $select = $users-select(); //select users where the login $select-where('login = ?', $request); //is the same like from REQUEST array $login = $users-fetchAll($select); if ( $login-login == '' ) { //if login is empty $valid = 'true'; //make valid true }else{//else $valid = 'false';//make valid false } $this-view-valid = $valid; //pass the valid to view } Checklogin view (checklogin.phtml): ?php echo $this-valid; //show result of valid ? Registration form view: ... script type=text/javascript src=?php echo $this-baseUrl;?/ public/scripts/jquery.js/script script type=text/javascript src=?php echo $this-baseUrl;?/ public/scripts/jquery.validate.js/script ... script type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#signupform).validate({ rules: { login: { required: true, minlength: 2, remote: checklogin -- dosen't work }, pass: { required: true, minlength: 5 }, pass_confirm: { required: true, minlength: 5, equalTo: #pass } }, messages: { login: { required: Enter login, minlength: jQuery.format(Enter at least {0} characters), remote: jQuery.format({0} is already in use) }, pass: { required: Enter password, minlength: jQuery.format(Enter at least {0} characters) }, pass_confirm: { required: Repeat password, minlength: jQuery.format(Enter at least {0} characters), equalTo: Powtórzone hasło jest nieprawidłowe } }, // set this class to error-labels to indicate valid fields success: function(label) { // set nbsp; as text for IE label.html(nbsp;).addClass(checked); } }); }); /script ... form action= id=signupform autocomplete=off method=post label for=loginLogin*:/labelbr / input id=login type=text name=login /span class=status/spanbr / label for=passPassword*:/labelbr / input id=pass type=password name=pass /span class=status/spanbr / label for=passConfirm password*:/labelbr / input id=pass_confirm type=password name=pass_confirm / span class=status/spanbr /br / input type=submit name=signup value=Register / /form ... The main problem is in '..remote: checklogin...'. This function dosen't work even I put in checklogin method only $this-views-valid = 'false' . The registration form view and checklogin view works with the same controller. I don't now why its dosen't work. Please help! David
[jQuery] Re: help: Zend Framework and JQuery validation plugin
Can you post a testpage? Jörn 2008/10/16 Namrasit [EMAIL PROTECTED]: Hi! I try to use Zend Framework with JQuery validation plugin. Standard validation of forms works good but when I want to remote validate (f.e check a login in database) remote function dosen't work. Below I write a code with method from controller and views listing: Method from controller: function checkloginAction(){ $request = trim(strtolower($_REQUEST['login'])); //take data from global REQUEST array $users = new Users(); //make a new class with users $select = $users-select(); //select users where the login $select-where('login = ?', $request); //is the same like from REQUEST array $login = $users-fetchAll($select); if ( $login-login == '' ) { //if login is empty $valid = 'true'; //make valid true }else{//else $valid = 'false';//make valid false } $this-view-valid = $valid; //pass the valid to view } Checklogin view (checklogin.phtml): ?php echo $this-valid; //show result of valid ? Registration form view: ... script type=text/javascript src=?php echo $this-baseUrl;?/ public/scripts/jquery.js/script script type=text/javascript src=?php echo $this-baseUrl;?/ public/scripts/jquery.validate.js/script ... script type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#signupform).validate({ rules: { login: { required: true, minlength: 2, remote: checklogin -- dosen't work }, pass: { required: true, minlength: 5 }, pass_confirm: { required: true, minlength: 5, equalTo: #pass } }, messages: { login: { required: Enter login, minlength: jQuery.format(Enter at least {0} characters), remote: jQuery.format({0} is already in use) }, pass: { required: Enter password, minlength: jQuery.format(Enter at least {0} characters) }, pass_confirm: { required: Repeat password, minlength: jQuery.format(Enter at least {0} characters), equalTo: Powtórzone hasło jest nieprawidłowe } }, // set this class to error-labels to indicate valid fields success: function(label) { // set nbsp; as text for IE label.html(nbsp;).addClass(checked); } }); }); /script ... form action= id=signupform autocomplete=off method=post label for=loginLogin*:/labelbr / input id=login type=text name=login /span class=status/spanbr / label for=passPassword*:/labelbr / input id=pass type=password name=pass /span class=status/spanbr / label for=passConfirm password*:/labelbr / input id=pass_confirm type=password name=pass_confirm / span class=status/spanbr /br / input type=submit name=signup value=Register / /form ... The main problem is in '..remote: checklogin...'. This function dosen't work even I put in checklogin method only $this-views-valid = 'false' . The registration form view and checklogin view works with the same controller. I don't now why its dosen't work. Please help! David
[jQuery] Re: help: Zend Framework and JQuery validation plugin
Ok. I create a simple testpage. Below I wrote all listing from index controller and view files: IndexController.php: ?php class IndexController extends Zend_Controller_Action { function init() { $this-view-baseUrl = $this-_request-getBaseUrl(); Zend_Loader::loadClass('Users'); } function indexAction(){ $this-view-title = ZF - Validation; } function checkloginAction(){ $request = trim(strtolower($_REQUEST['login'])); $valid = 'true'; $users = new Users(); $select = $users-select(); $select-where('login = ?', $request); $usernames = $users-fetchAll($select); foreach($usernames as $username) : if($username-login != ''){ $valid = 'false'; } endforeach; $this-view-valid = $valid; } } index.phtml : !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / link rel=stylesheet type=text/css media=screen href=?php echo $this-baseUrl;?/public/styles/site.css / script type=text/javascript src=?php echo $this-baseUrl;?/ public/scripts/jquery.js/script script type=text/javascript src=?php echo $this-baseUrl;?/ public/scripts/jquery.validate.js/script title?php echo $this-escape($this-title); ?/title /head script type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#signupform).validate({ rules: { login: { required: true, minlength: 2, remote: checklogin //-- dosen't work } }, messages: { login: { required: Enter login, minlength: jQuery.format(Enter at least {0} characters), remote: jQuery.format({0} is already in use) } }, // set this class to error-labels to indicate valid fields success: function(label) { // set nbsp; as text for IE label.html(nbsp;).addClass(checked); } }); }); /script body xml:lang=pl div id=container br / form action=sample.php id=signupform autocomplete=off method=post label for=loginLogin:/labelbr / input id=login type=text name=login / br / br / input type=submit name=signup value=Register / /form /div /body /html checklogin.phtml : ?php echo $this-valid; ? Why the remote validation still dosen't work? I don't know what insert into remote function. Please help. David On Oct 16, 5:58 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: Can you post a testpage? Jörn 2008/10/16 Namrasit [EMAIL PROTECTED]: Hi! I try to use Zend Framework with JQuery validation plugin. Standard validation of forms works good but when I want to remote validate (f.e check a login in database) remote function dosen't work. Below I write a code with method from controller and views listing: Method from controller: function checkloginAction(){ $request = trim(strtolower($_REQUEST['login'])); //take data from global REQUEST array $users = new Users(); //make a new class with users $select = $users-select(); //select users where the login $select-where('login = ?', $request); //is the same like from REQUEST array $login = $users-fetchAll($select); if ( $login-login == '' ) { //if login is empty $valid = 'true'; //make valid true }else{ //else $valid = 'false'; //make valid false } $this-view-valid = $valid; //pass the valid to view } Checklogin view (checklogin.phtml): ?php echo $this-valid; //show result of valid ? Registration form view: ... script type=text/javascript src=?php echo $this-baseUrl;?/ public/scripts/jquery.js/script script type=text/javascript src=?php echo $this-baseUrl;?/ public/scripts/jquery.validate.js/script ... script type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#signupform).validate({ rules: { login: { required: true, minlength: 2, remote: checklogin -- dosen't work }, pass: { required: true, minlength: 5 }, pass_confirm
[jQuery] [Validation plugin] attaching onclick validation to checkboxes before submit button is clicked?
Using the Validation plugin (http://docs.jquery.com/Plugins/ Validation/) I've got checkboxes like this: input type=checkbox name=q4 id=q4 value=1 / input type=checkbox name=q4 id=q4 value=2 / input type=checkbox name=q4 id=q4 value=3 / input type=checkbox name=q4 id=q4 value=4 / input type=checkbox name=q4 id=q4 value=5 / and the following code making sure that only 3 can be chosen: $(document).ready(function() { $('#fQuestionnaire1').validate({ rules: { q4: { required: true, maxlength: 3 } } }); }); This sort of works fine - when I click the form's Submit button, the error message is displayed if more than three are selected. And from then on, the error message is toggled on and off by my ticking the required number of boxes. But - and here's my question - I want that behaviour BEFORE I've hit Submit. As soon as I click that 4th checkbox, I want the error message to appear. Currently it's happy to let me select 4 items and then gives me the message when I hit Submit. I notice that the docs for the validate() onfocusout option - which defaults to true - says Validate elements (except checkboxes/radio buttons) on blur. Why are they excluded? It's clearly possible to do, because it does validate onblur AFTER the submit button has fired once. Is this work-aroundable? Am I missing something important? Thanks :)
[jQuery] change filedname from ID in jquery validation plugin
Hi, I am using Jquery plugin for client side validation. But due to a filedname I am facing a problem. Example var validator = $(#UserSignupForm).validate({ rules: { data[User][username]: { required: true, minlength: 2, remote: users.php } }); HTML :input id=id_username1 name=data[User][username] type=text value= maxlength=50 /
[jQuery] change filedname from ID in jquery validation plugin
Hi, I am using Jquery plugin for client side validation. But due to a filedname I am facing a problem. Example var validator = $(#UserSignupForm).validate({ rules: { data[User][username]: { required: true, minlength: 2, remote: users.php } }); HTML :input id=id_username1 name=data[User][username] type=text value= maxlength=50 / When I am using data[User][username] as a filed name in jquery validation, it's not working but in case of other name like username it's working. I think there is problem of [][] (bracket of array). But I can not change data[User][username] so I want to use id_username1 instead of filename in validation plugin but don't know how to use ID ?. Is there any other solution? Also I have to face same problem in many plugins becuase CakePHP return name like data[User][username] so How can I override a name from ID? Please Help me Thanks -- View this message in context: http://www.nabble.com/change-filedname-from-ID-in-jquery-validation-plugin-tp19940820s27240p19940820.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: jQuery validation plugin - Italian Translation
Done: http://jqueryjs.googlecode.com/svn/trunk/plugins/validate/localization/messages_it.js Jörn 2008/10/5 Jörn Zaefferer [EMAIL PROTECTED]: Could you sent that as file js file to me? Thanks Jörn On Sun, Oct 5, 2008 at 1:58 PM, caruso_g [EMAIL PROTECTED] wrote: Thanks a lot for your translation, just some typos/errata: email: Inserisci un indirizzo mail valido., should be email: Inserisci un indirizzo email valido., number: Inserisci un numero valida., should be number: Inserisci un numero valido., equalTo: Il valore non coincide., could be equalTo: Il valore non corrisponde., accept: Inserisci una valore con una estensione valida., should be accept: Inserisci un valore con unapos;estensione valida., maxlength: jQuery.format(Non inserire più di {0} caratteri.), should be maxlength: jQuery.format(Non inserire piugrave; di {0} caratteri.), max: jQuery.format(Inserisci un valore minore od uguale a {0}.), should be max: jQuery.format(Inserisci un valore minore o uguale a {0}.), min: jQuery.format(Inserisci un valore maggiore od uguale a {0}.) should be min: jQuery.format(Inserisci un valore maggiore o uguale a {0}.) Thanks again.
[jQuery] Re: jQuery validation plugin - Italian Translation
Thanks a lot for your translation, just some typos/errata: email: Inserisci un indirizzo mail valido., should be email: Inserisci un indirizzo email valido., number: Inserisci un numero valida., should be number: Inserisci un numero valido., equalTo: Il valore non coincide., could be equalTo: Il valore non corrisponde., accept: Inserisci una valore con una estensione valida., should be accept: Inserisci un valore con unapos;estensione valida., maxlength: jQuery.format(Non inserire più di {0} caratteri.), should be maxlength: jQuery.format(Non inserire piugrave; di {0} caratteri.), max: jQuery.format(Inserisci un valore minore od uguale a {0}.), should be max: jQuery.format(Inserisci un valore minore o uguale a {0}.), min: jQuery.format(Inserisci un valore maggiore od uguale a {0}.) should be min: jQuery.format(Inserisci un valore maggiore o uguale a {0}.) Thanks again.
[jQuery] Re: jQuery validation plugin - Italian Translation
Could you sent that as file js file to me? Thanks Jörn On Sun, Oct 5, 2008 at 1:58 PM, caruso_g [EMAIL PROTECTED] wrote: Thanks a lot for your translation, just some typos/errata: email: Inserisci un indirizzo mail valido., should be email: Inserisci un indirizzo email valido., number: Inserisci un numero valida., should be number: Inserisci un numero valido., equalTo: Il valore non coincide., could be equalTo: Il valore non corrisponde., accept: Inserisci una valore con una estensione valida., should be accept: Inserisci un valore con unapos;estensione valida., maxlength: jQuery.format(Non inserire più di {0} caratteri.), should be maxlength: jQuery.format(Non inserire piugrave; di {0} caratteri.), max: jQuery.format(Inserisci un valore minore od uguale a {0}.), should be max: jQuery.format(Inserisci un valore minore o uguale a {0}.), min: jQuery.format(Inserisci un valore maggiore od uguale a {0}.) should be min: jQuery.format(Inserisci un valore maggiore o uguale a {0}.) Thanks again.
[jQuery] jQuery validation plugin - Italian Translation
filename: messages_it.js /* * Traduzione dei messaggi di default per il pugin jQuery validation. * Language: IT * Traduzione a cura di Davide Falchetto * E-mail: [EMAIL PROTECTED] * Web: www.d4solutions.it */ jQuery.extend(jQuery.validator.messages, { required: Campo obbligatorio., remote: Controlla questo campo., email: Inserisci un indirizzo mail valido., url: Inserisci un indirizzo web valido., date: Inserisci una data valida., dateISO: Inserisci una data valida (ISO)., number: Inserisci un numero valida., digits: Inserisci solo numeri., creditcard: Inserisci un numero di carta di credito valido., equalTo: Il valore non coincide., accept: Inserisci una valore con una estensione valida., maxlength: jQuery.format(Non inserire più di {0} caratteri.), minlength: jQuery.format(Inserisci almeno {0} caratteri.), rangelength: jQuery.format(Inserisci un valore compreso tra {0} e {1} caratteri.), range: jQuery.format(Inserisci un valore compreso tra {0} e {1}.), max: jQuery.format(Inserisci un valore minore od uguale a {0}.), min: jQuery.format(Inserisci un valore maggiore od uguale a {0}.) });
[jQuery] Re: jQuery validation plugin in Drupal
Aah! *Slaps forehead* I found the problem! I was creating the validation rules and messages by referring to the id's of the form fields, while I should just reference their names! Everything's working now, thanks for your time. Jeroen On 2 okt, 03:24, Jörn Zaefferer [EMAIL PROTECTED] wrote: Could you reduce your non-working testpage to just one non-working element? I still can't see the issue. The validation seems to work just fine. Jörn On Wed, Oct 1, 2008 at 11:57 PM,JeroenCoumans[EMAIL PROTECTED] wrote: Ok, I've further debugged this, trying to find the exact circumstances in which the validator doesn't work. Now I noticed that the values of the name and id attributes of input fields aren't the same. I've created a fixed version: http://lab.jeroencoumans.nl/register/index-fixed-name.html And now the validator works! So it seems that the name and id attributes ought to be the same in order for the validator plugin to work. But Drupal automatically creates the name attribute without the edit- part which it prepends in the id attribute. Is there any way I can get the validator plugin to work without having to hack the way Drupal spits out its forms? Regards, Jeroen On 1 okt, 15:16, Jörn Zaefferer [EMAIL PROTECTED] wrote: Could you summarize the problem again? I looked at the testpage and couldn't see anything wrong with it. Jörn On Tue, Sep 30, 2008 at 6:16 PM,JeroenCoumans[EMAIL PROTECTED] wrote: Could it have something to do with the fact that each id starts with edit-? When I try it with manually created markup, changing or removing the dashes doesn't help, but removing the edit- part does. Is there a workaround possible? Thanks, Jeroen On 29 sep, 00:06,Jeroen Coumans[EMAIL PROTECTED] wrote: Hi, I've uploaded the form with the generated HTML markup at: http://lab.jeroencoumans.nl/register/ Thanks a lot, Jeroen On 27 sep, 13:26, Jörn Zaefferer [EMAIL PROTECTED] wrote: Yes, an example would help a lot. Jörn On Sat, Sep 27, 2008 at 12:45 PM,JeroenCoumans [EMAIL PROTECTED] wrote: Thanks, I tried that but it doesn't seem to work. Drupal applies the classes required to required form fields, and they're picked up correctly. But any rule I add doesn't work at all. Even a single rule to make an extra field required doesn't get picked up. Would it help if I setup an example of what I'm trying to achieve? Thanks, Jeroen On 27 sep, 02:57, Jörn Zaefferer [EMAIL PROTECTED] wrote: Yes, details can be found here:http://docs.jquery.com/Plugins/Validation/Reference#Fields_with_compl... Jörn On Sat, Sep 27, 2008 at 2:34 AM,JeroenCoumans[EMAIL PROTECTED] wrote: Hi, When trying to use the validator plugin, I get the following error: missing : after property id edit-name: required, It seems like it has problems with the - that Drupal puts in the id's of each form field. Is there a workaround possible? Thanks, JeroenCoumans
[jQuery] Re: jQuery validation plugin in Drupal
Could you summarize the problem again? I looked at the testpage and couldn't see anything wrong with it. Jörn On Tue, Sep 30, 2008 at 6:16 PM, Jeroen Coumans [EMAIL PROTECTED] wrote: Could it have something to do with the fact that each id starts with edit-? When I try it with manually created markup, changing or removing the dashes doesn't help, but removing the edit- part does. Is there a workaround possible? Thanks, Jeroen On 29 sep, 00:06, Jeroen Coumans [EMAIL PROTECTED] wrote: Hi, I've uploaded the form with the generated HTML markup at: http://lab.jeroencoumans.nl/register/ Thanks a lot, Jeroen On 27 sep, 13:26, Jörn Zaefferer [EMAIL PROTECTED] wrote: Yes, an example would help a lot. Jörn On Sat, Sep 27, 2008 at 12:45 PM, Jeroen Coumans [EMAIL PROTECTED] wrote: Thanks, I tried that but it doesn't seem to work. Drupal applies the classes required to required form fields, and they're picked up correctly. But any rule I add doesn't work at all. Even a single rule to make an extra field required doesn't get picked up. Would it help if I setup an example of what I'm trying to achieve? Thanks, Jeroen On 27 sep, 02:57, Jörn Zaefferer [EMAIL PROTECTED] wrote: Yes, details can be found here:http://docs.jquery.com/Plugins/Validation/Reference#Fields_with_compl... Jörn On Sat, Sep 27, 2008 at 2:34 AM, Jeroen Coumans [EMAIL PROTECTED] wrote: Hi, When trying to use the validator plugin, I get the following error: missing : after property id edit-name: required, It seems like it has problems with the - that Drupal puts in the id's of each form field. Is there a workaround possible? Thanks, Jeroen Coumans
[jQuery] Re: jQuery validation plugin in Drupal
Drupal generates input fields with an id like edit-profile-name. The jQuery validator plugin seems to ignore those fields completely, at least on the form at http://lab.jeroencoumans.nl/register/ (which is the generated HTML from a custom Drupal registration form). Quoting the id when referencing them for custom rules or messages doesn't help. Thanks, Jeroen On 1 okt, 15:16, Jörn Zaefferer [EMAIL PROTECTED] wrote: Could you summarize the problem again? I looked at the testpage and couldn't see anything wrong with it. Jörn On Tue, Sep 30, 2008 at 6:16 PM, Jeroen Coumans [EMAIL PROTECTED] wrote: Could it have something to do with the fact that each id starts with edit-? When I try it with manually created markup, changing or removing the dashes doesn't help, but removing the edit- part does. Is there a workaround possible? Thanks, Jeroen On 29 sep, 00:06, Jeroen Coumans [EMAIL PROTECTED] wrote: Hi, I've uploaded the form with the generated HTML markup at: http://lab.jeroencoumans.nl/register/ Thanks a lot, Jeroen On 27 sep, 13:26, Jörn Zaefferer [EMAIL PROTECTED] wrote: Yes, an example would help a lot. Jörn On Sat, Sep 27, 2008 at 12:45 PM, Jeroen Coumans [EMAIL PROTECTED] wrote: Thanks, I tried that but it doesn't seem to work. Drupal applies the classes required to required form fields, and they're picked up correctly. But any rule I add doesn't work at all. Even a single rule to make an extra field required doesn't get picked up. Would it help if I setup an example of what I'm trying to achieve? Thanks, Jeroen On 27 sep, 02:57, Jörn Zaefferer [EMAIL PROTECTED] wrote: Yes, details can be found here:http://docs.jquery.com/Plugins/Validation/Reference#Fields_with_compl... Jörn On Sat, Sep 27, 2008 at 2:34 AM, Jeroen Coumans [EMAIL PROTECTED] wrote: Hi, When trying to use the validator plugin, I get the following error: missing : after property id edit-name: required, It seems like it has problems with the - that Drupal puts in the id's of each form field. Is there a workaround possible? Thanks, Jeroen Coumans