Solved

ASP.NET - Disabling validation control when textbox is dynamically hidden with Javascript

Posted on 2004-09-08
2
521 Views
Last Modified: 2010-05-18
I have a number of rows in a table for data input, such as:

      <tr class="orig" id="kid1" style="DISPLAY: none">
            <td>
                  <br />
                  <asp:TextBox id="txtF1" runat="server"></asp:TextBox>
                  <asp:RequiredFieldValidator id="RequiredFieldValidator1a" runat="server" ControlToValidate="txtF1">*</asp:RequiredFieldValidator>
                  <asp:TextBox id="txtL1" runat="server"></asp:TextBox>
                  <asp:RequiredFieldValidator id="RequiredFieldValidator1b" runat="server" ControlToValidate="txtL1">*</asp:RequiredFieldValidator>
            </td>
      </tr>

Then I'm using Javascript to set document.all.kid1.style.display="inline" or ="none" to show/hide different rows.

The problem is that even though a row is hidden the validator control is still enabled.  When I hide the row I can set the textboxes to some bogus value to fool the validator but is there any way to disable the validator in the first place?

Thanks for your help!  =)
0
Comment
Question by:welly1
2 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 150 total points
ID: 12013310
Hi

Check this page: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspplusvalid.asp

Especially search for ValidatorEnable(val, enable) :)

Regards,
Zyloch
0
 

Author Comment

by:welly1
ID: 12022358
Fantastic Zyloch!

I know there had to be an easy way...

Thanks for your help!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question