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