Hello brian and all, Thanks for your time! Now I've added the following method: $.validator.addMethod( "regexp",function (value, element, regexp) { var check=false; var re=new RegExp (regexp); return this.optional(element) || re.test (value); }, "Please check your input.");
It works well here but it doesn't monitor the changes. Say, I entered a wrong login, than I went back and corrected it. At this time it still says "Incorrect login". What might be the reason? What check do I need to implement? -- With best regards from Ukraine, Andre Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule ----- Original message ----- From: brian <zijn.digi...@gmail.com> To: jquery-en@googlegroups.com <jquery-en@googlegroups.com> Date: Wednesday, November 25, 2009, 8:14:12 PM Subject: [jQuery] Please help to check the form... On Wed, Nov 25, 2009 at 1:03 PM, Andre Polykanine <an...@arthaelon.net> wrote: > Hello brian and all, > > I was attempting to validate the form manually and had deep problems > with it. > Now I'm using jQuery.validate plugin and almost everything goes OK, > but I still have a couple of missunderstandings: > 1. How can I tell the plugin that a valid login (#ulogin) is a login that fits > to a regexp or, say, just doesn't contain whitespaces? Have a look at this: http://stackoverflow.com/questions/280759/jquery-validate-how-to-add-a-rule-for-regular-expression-validation > 2. For some reason I can't make the plugin validate a group of > radiobuttons (gender selection) that is required. I'm using > $("#signup").validate( { > rules: { > ... > usex1: "required", > ... > } > }); > ... > <fieldset id="ugender"> > <legend>Select your gender:</legend> > <input type="radio" name="usex" id="usex1" value=1>Male<br> > <input type="radio" name="usex" id="usex2" value=2>Female > </fieldset> > What am I doing wrong? I tried to validate #ugender but it didn't > help, either. For the rules, the key is the name attribute of the element. You're using the ID of one of the radio buttons. Try: usex: "required",