0

Hi, everyone. I am having difficulty with the following: I have a form with several RequiredFieldValidator controls on it. My user can take path 'A', down which all of these apply, or path 'B', down which only some of them apply. How can I 'disable' some of my validators (not all) so that when the form is submitted, these empty textboxes don't stop me? This is different from setting the CausesValidation property of a Cancel button to false. Thanks for any help! Steve--

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Ramesh S
0

Do not use validation controls. Use JavaScript.

Have a look at code snippet,

...
    <script type="text/javascript">
        function DoSubmit() {
            var btn = document.activeElement;
            if (btn.value == "A") {
                alert("Do this");
                return false;
            }
            else
            if (btn.value == "B") {
                alert("Do this");
                return false;
            }
        
            return true;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server" onsubmit="return DoSubmit()">
  
...

Edited by __avd: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.