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?
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.

-- 
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, 7:47:03 PM
Subject: [jQuery] Please help to check the form...

What is the problem you are trying to solve? What behaviour are you
seeing to suggest it is wrong?

On Wed, Nov 25, 2009 at 6:55 AM, Andre Polykanine
<andre.polykan...@gmail.com> wrote:
> Hello everyone,
> Sorry, not sure if the message passed through the first time, so
> repeating it.
>
> I'm new to JQuery, so please don't be too strict).
> I'm checking user input in the form. The form is usual but there's
> rather many check-outs. I preferred to display them Div's if the
> fields are not completed or are completet incorrectly.
> What I'm trying to do is to keep the Submit button disabled in case of
> exceptions and re-enable it when everything is OK.
> Here's a part of the code:
> $(function () {
> // disabling the button by default
> $("#go").attr("disabled", "disabled");
>                                  try {
> // We begin processing the fields
> $("#ulogin").blur (function (event) {
> var ulogin=$(this).val();
> // There's a function isValidLogin checking the login by regExp
> if ((ulogin=="") || (!isValidLogin (ulogin))) {
> // Showing them a <div>
> $("#errlogin").show();
> //Throwing "Incorrect login" message
> throw new Error("<?=MSG37?>");
> } else {
> $("#errlogin").hide();
> // Enabling the button, everything goes OK
> $("#go").attr("disabled", "");
> }
> } );
>
> // ... All the fields in the same manner
>
> } catch(e) {
> $("#go").attr("disabled", "disabled");
> }
> } );
>
> What am I doing wrong? Is there a better way?
> Thanks in advance!
>
> --
> 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
>
>

Reply via email to