[jQuery] Re: How to remove error messages from Validation Plugin
Here is an interesting way to do it. In my case, I was using a main error div at the top of the page, so I didn't need the individual label.error elements inline. They kept showing up no matter what I did until I added this to my validation: errorElement: em This changes the element that the errors are displayed in from label to em. I am not using any em elements on my page, so the error messages just don't show up (except the main one, which I want to show up). jQuery.validator.messages.required = ; $('#member_form').validate({ //change error element errorElement: em, //use main error div instead invalidHandler: function(e, validator) { var errors = validator.numberOfInvalids(); if (errors) { var message = errors == 1 ? 'You missed 1 field. It has been highlighted below' : 'You missed ' + errors + ' fields. They have been highlighted below'; $(div.error span).html(message); $(div.error).show(); } else { $(div.error).hide(); } }, rules: { username: { required: true, email: true }, password: { required: true, minlength: 4, maxlength: 10 }, password_confirm: { required: true, equalTo: #password, minlength: 4, maxlength: 10 }, accept_terms: required, cf_member_fname: required, cf_member_lname: required, cf_member_city: required, cf_member_country: required, captcha: required } }); On Apr 10, 8:08 pm, Rick r...@marketingease.com wrote: I'm using this plugin in its simplest form..http://docs.jquery.com/Plugins/Validation All I have is this for my code: script $(document).ready(function(){ $(#form).validate();}); /script It works fine, but I'm trying to hide the error messages which it defaults to This field is required. The error message shows up in a label.. How in the world do I hide those error messages within those labels??? I'm sure it's easy, but I cannot find any examples anywhere!! Thanks to whoever helps out..
[jQuery] Re: How to remove error messages from Validation Plugin
Actually, it does not work. Validation plugu-in overrides display:none css attribute with its own display:inline. Feryt. On 11 Dub, 16:15, Chuck Harmston cpharms...@gmail.com wrote: I don't recommend this, as it will stop users from submitting the form without giving them a reason for it. Talk about a usability nightmare. However, if you insist on it, there is a simple enough solution: just use CSS to style the .error class: label.error{display:none} Chuck Harmstonhttp://chuckharmston.com On Fri, Apr 10, 2009 at 10:08 PM, Rick r...@marketingease.com wrote: I'm using this plugin in its simplest form.. http://docs.jquery.com/Plugins/Validation All I have is this for my code: script $(document).ready(function(){ $(#form).validate(); }); /script It works fine, but I'm trying to hide the error messages which it defaults to This field is required. The error message shows up in a label.. How in the world do I hide those error messages within those labels??? I'm sure it's easy, but I cannot find any examples anywhere!! Thanks to whoever helps out..
[jQuery] Re: How to remove error messages from Validation Plugin
You can set the text to display in the error message. I did it so that the test displayed is empty strings. $(#registerForm).validate({ errorContainer: #messageBox, errorClass: required, rules: { reg_email: { required: true, email: true }, reg_pwd: required, } , messages: { reg_email: , reg_pwd: , } }) On May 4, 6:08 am, Feryt skoru...@gmail.com wrote: Actually, it does not work. Validation plugu-in overrides display:none css attribute with its own display:inline. Feryt. On 11 Dub, 16:15, Chuck Harmston cpharms...@gmail.com wrote: I don't recommend this, as it will stop users from submitting the form without giving them a reason for it. Talk about a usability nightmare. However, if you insist on it, there is a simple enough solution: just use CSS to style the .error class: label.error{display:none} Chuck Harmstonhttp://chuckharmston.com On Fri, Apr 10, 2009 at 10:08 PM, Rick r...@marketingease.com wrote: I'm using this plugin in its simplest form.. http://docs.jquery.com/Plugins/Validation All I have is this for my code: script $(document).ready(function(){ $(#form).validate(); }); /script It works fine, but I'm trying to hide the error messages which it defaults to This field is required. The error message shows up in a label.. How in the world do I hide those error messages within those labels??? I'm sure it's easy, but I cannot find any examples anywhere!! Thanks to whoever helps out..- Hide quoted text - - Show quoted text -
[jQuery] Re: How to remove error messages from Validation Plugin
I don't recommend this, as it will stop users from submitting the form without giving them a reason for it. Talk about a usability nightmare. However, if you insist on it, there is a simple enough solution: just use CSS to style the .error class: label.error{display:none} Chuck Harmston http://chuckharmston.com On Fri, Apr 10, 2009 at 10:08 PM, Rick r...@marketingease.com wrote: I'm using this plugin in its simplest form.. http://docs.jquery.com/Plugins/Validation All I have is this for my code: script $(document).ready(function(){ $(#form).validate(); }); /script It works fine, but I'm trying to hide the error messages which it defaults to This field is required. The error message shows up in a label.. How in the world do I hide those error messages within those labels??? I'm sure it's easy, but I cannot find any examples anywhere!! Thanks to whoever helps out..