How to execute client-side code _after_ client-side validation?

Discussion in 'ASP .Net' started by Bogdan, Jun 8, 2008.

  1. Bogdan

    Bogdan Guest

    Hi,

    I'd like to display (i.e. make visible) a label after a submit button is
    clicked but only if the client-side validation is successful. If I did not
    care about the validation then I'd simply modify style.display of the label
    in my onclick (OnClientClick) script. The problem is that my script will
    execute before the validation script.
    Is there a way to execute my custom script after the validation takes place?

    Thanks,
    Bogdan
     
    Bogdan, Jun 8, 2008
    #1
    1. Advertising

  2. Bogdan

    bruce barker Guest

    use ClientSCriptManager.RegisterOnSubmitStatement

    -- bruce (sqlwork.com)

    Bogdan wrote:
    > Hi,
    >
    > I'd like to display (i.e. make visible) a label after a submit button is
    > clicked but only if the client-side validation is successful. If I did not
    > care about the validation then I'd simply modify style.display of the label
    > in my onclick (OnClientClick) script. The problem is that my script will
    > execute before the validation script.
    > Is there a way to execute my custom script after the validation takes place?
    >
    > Thanks,
    > Bogdan
    >
    >
    >
     
    bruce barker, Jun 8, 2008
    #2
    1. Advertising

  3. Bogdan

    Bogdan Guest

    Bruce,

    Thanks for the reply. Your suggestion only partially worked for me. I have
    a RequiredFieldValidator and RegularExpressionValidator attached to fields.
    If the former fails than my onsumbit script is not executed. Unfortunately,
    this is not the case for the regex validator - my onsubmit is executed
    regardless if the validator fails or not. I tested it in IE, FireFox, and
    Safari and got similar results.

    Is OnSubmitStatement supposed to execute AFTER validators and only if the
    validators are successful? I can't find any reference to it in the on-line
    docs. I'd appreciate any links.

    Thanks again,
    Bogdan


    "bruce barker" <> wrote in message
    news:%...
    > use ClientSCriptManager.RegisterOnSubmitStatement
    >
    > -- bruce (sqlwork.com)
    >
    > Bogdan wrote:
    >> Hi,
    >>
    >> I'd like to display (i.e. make visible) a label after a submit button is
    >> clicked but only if the client-side validation is successful. If I did
    >> not care about the validation then I'd simply modify style.display of the
    >> label in my onclick (OnClientClick) script. The problem is that my
    >> script will execute before the validation script.
    >> Is there a way to execute my custom script after the validation takes
    >> place?
    >>
    >> Thanks,
    >> Bogdan
    >>
     
    Bogdan, Jun 9, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    14
    Views:
    4,220
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  2. =?Utf-8?B?dmlkeWE=?=
    Replies:
    1
    Views:
    787
    Kevin Spencer
    Jun 2, 2005
  3. Boss302
    Replies:
    0
    Views:
    1,109
    Boss302
    Nov 21, 2006
  4. turboJeeper
    Replies:
    2
    Views:
    378
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
    Feb 1, 2007
  5. Bogdan
    Replies:
    1
    Views:
    1,672
    Gregory A. Beamer
    Dec 8, 2009
Loading...

Share This Page