Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

How to avoid hideen required filed validator to submit form.

$
0
0

Hi friends,

I designed a page in ".aspx" format, on that page I have a radio button list that is used to hide and display some more fields on that page: -

<head><script src="js/jquery-1.11.1.min.js" type="text/javascript"></script>  <script type="text/javascript">
    function ShowMe() {
        //Code to get the selected value from RadioButtonList
        var selectedvalue = $('#<%= rbExperience.ClientID %> input:checked').val();
        //var x = document.getElementById("rbExperience").value;
        if (selectedvalue == "Yes") {
            // Show the div$("#Experience_Detail").show(1000);
        }
        else {
            //Hide the div$("#Experience_Detail").hide(1000);            
        }
    }</script></head><body><form id="form1" runat="server"><div style="width:700px;overflow:hidden;"><div class="divTable" style="width:400px;">Do You Have Professional Experience</div><div class="divTable"><asp:RadioButtonList ID="rbExperience" runat="server" RepeatDirection="Horizontal"  onchange="ShowMe()"><asp:ListItem Enabled="true" Text="Yes" Value="Yes"></asp:ListItem><asp:ListItem Enabled="true" Text="No" Value="No"></asp:ListItem></asp:RadioButtonList></div></div><div style="width:90%;height:280px; overflow:hidden;display:none;" id="Experience_Detail"><div class="divTable">Total Months of Experience</div></div><div class="divTable"><asp:Button ID="btnSubmit" class="myButton" Text="Submit" runat="server" OnClick="btnSubmit_Click" /></div><div class="divTable"><asp:Label ID="lblMessage" Text="hello!" runat="server"></asp:Label></div></form></body></html>

In this page when I click "Radio Button List" On "Yes" it displays "Experience_Detail" div, on "No" it hides "Experience_Detail" div.

The main issue is that when clicking on "No" the Javascrpit is working smartly to hide "Experience_Detail" div, but all the text boxes inside the Experience_Detail div are 'required' so My page is not being submitted.

I want to submit the page even with required property on hidden text boxes.

Please suggest some remedy for this issue.

Thank You in advance.


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>