Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2004-09-08
2
Medium Priority
?
540 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 600 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month20 days, 21 hours left to enroll

810 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