Disable RequiredFieldValidator with Javascript?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dhnriverside

    Disable RequiredFieldValidator with Javascript?

    Hi guys

    Ok, I have a page with a couple of radio buttons. Next to the top one is a
    test box, and next the bottom one is a Listbox.

    The idea is that, depending which option is selected, you either type in the
    box or select from the list. So, always one or other of the textbox/listbox
    is disabled.

    I'm handling the switching with javascript called when the radio buttons are
    clicked.

    Works fine. However, I've got a required field validator for the text box
    and the listbox, and obviously I need to switch either one of those off as
    well.

    So, how can I disable the RequiredFieldVa lidator in Javascript?

    Cheers


    Dan
  • Jan Peter Stotz

    #2
    Re: Disable RequiredFieldVa lidator with Javascript?

    dhnriverside schrieb:
    [color=blue]
    > The idea is that, depending which option is selected, you either type in the
    > box or select from the list. So, always one or other of the textbox/listbox
    > is disabled.
    >
    > Works fine. However, I've got a required field validator for the text box
    > and the listbox, and obviously I need to switch either one of those off as
    > well.
    >
    > So, how can I disable the RequiredFieldVa lidator in Javascript?[/color]

    You may consider writing your own FieldValidator that is capable of
    validating two controls and accepts the input data as valid if the data of
    one control matches the requirements.

    Jan

    Comment

    • sreejith.ram@gmail.com

      #3
      Re: Disable RequiredFieldVa lidator with Javascript?

      There is a ValidatorEnable function in the Asp.net javacsript Script
      Library,that can enable disable individual validators ..

      Comment

      • dhnriverside

        #4
        Re: Disable RequiredFieldVa lidator with Javascript?

        Hi Jan

        I'd rather not on this budget :)

        Anyone know how to do this?



        "Jan Peter Stotz" wrote:
        [color=blue]
        > dhnriverside schrieb:
        >[color=green]
        > > The idea is that, depending which option is selected, you either type in the
        > > box or select from the list. So, always one or other of the textbox/listbox
        > > is disabled.
        > >
        > > Works fine. However, I've got a required field validator for the text box
        > > and the listbox, and obviously I need to switch either one of those off as
        > > well.
        > >
        > > So, how can I disable the RequiredFieldVa lidator in Javascript?[/color]
        >
        > You may consider writing your own FieldValidator that is capable of
        > validating two controls and accepts the input data as valid if the data of
        > one control matches the requirements.
        >
        > Jan
        >[/color]

        Comment

        • sreejith.ram@gmail.com

          #5
          Re: Disable RequiredFieldVa lidator with Javascript?


          Found it well documented here , pls look for 'Client-Side APIs' section



          Comment

          • dhnriverside

            #6
            Re: Disable RequiredFieldVa lidator with Javascript?

            Brilliant peice of information. Sorted - thank you!

            "sreejith.ram@g mail.com" wrote:
            [color=blue]
            >
            > Found it well documented here , pls look for 'Client-Side APIs' section
            >
            > http://msdn.microsoft.com/library/de...pplusvalid.asp
            >
            >[/color]

            Comment

            Working...