Solved

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

Posted on 2004-09-08
2
525 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: 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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

707 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