How to clearprevious form validations when accordion selection change

Last post 07-04-2008 10:44 AM by pinfriend. 2 replies.

Sort Posts:

  • How to clearprevious form validations when accordion selection change

    07-04-2008, 9:26 AM
    • Loading...
    • pinfriend
    • Joined on 06-24-2008, 9:15 AM
    • Posts 17

     Hi guys,

     I have an accordian control that has 3 panes.
    1) The first allows a user to update some of his details (Fullname, email etc) with 3 buttons (Update, Delete and Cancel)
    2) The second pane has form fields to reset his user password with 3 textboxes and a reset button
    3) The third pane has a button to reset failed login attemps

     Here's my problem. Because I'm using asp validators on most of  controls on the form, when clicking working on the second pane and trying to submit the user details, the form controls
    in the first pane gets validated and even if not validation failed on the second pane, the form does not submit, because of the controls in the first pane fail to pass validation.

    Somehow I need to disable validation on say, panes one and 3 when working on pane selected pane 2 and vice versa for pane one and two. I thought maybe and SelectedIndexChanged event
    handles, but I don't know how to do it

    Any suggenstions would be welcome


    Thanx 

  • Re: How to clearprevious form validations when accordion selection change

    07-04-2008, 10:11 AM

     you can use validation groups to achieve this. so for e.g

     

    1) The first allows a user to update some of his details (Fullname, email etc) with 3 buttons (Update, Delete and Cancel) 

     for the fields and button set the validationgroup property to equal "vg1" and for all controls in second pane set a different value e.t.c

     

  • Re: How to clearprevious form validations when accordion selection change

    07-04-2008, 10:44 AM
    • Loading...
    • pinfriend
    • Joined on 06-24-2008, 9:15 AM
    • Posts 17

    Solved it just before I read your reply.

    This is what I did .

    I added this code to my <header> section of my accordionPane

     

    1    <cc1:AccordionPane ID="apEditUser" runat="server">
    2      <Header>
    3        <a href="#" onclick="disableValidation(); return false;" class="accordionLink">
    4          <img src="../images/arrow_right_w.gif" style="border: none" alt="" />
    5          User Details
    6        </a>
    7    </Header>
    

     And then added the following javascript for all the aspValidators

     

    1    <script language="javascript" type="text/javascript">
    2   
    3    function disableValidation()
    4    {
    5    var valOldPassword = document.getElementById("<%=valOldPassword.ClientID%>");
    6    var valNewPassword = document.getElementById("<%=valNewPassword.ClientID%>");
    7    var valComparePasswords = document.getElementById("<%=valComparePasswords.ClientID%>");
    8   
    9    var varFullname = document.getElementById("<%=valFullname.ClientID%>");
    10   var valEmail = document.getElementById("<%=valEmail.ClientID%>");
    11   var valValidemail = document.getElementById("<%=valValidEmail.ClientID%>");
    12  
    13   ValidatorEnable(valOldPassword, false);
    14   ValidatorEnable(valNewPassword, false);
    15   ValidatorEnable(valComparePasswords, false);
    16   ValidatorEnable(varFullname, false);
    17   ValidatorEnable(valEmail, false);
    18   ValidatorEnable(valValidemail, false);
    19   }
    20  
    21   </script>
    22  

    Thanx

     
Page 1 of 1 (3 items)
Microsoft Communities
Page view counter