Use of Required filled validator

Last post 11-05-2009 2:07 AM by Shengqing Yang - MSFT. 3 replies.

Sort Posts:

  • Use of Required filled validator

    11-04-2009, 9:33 AM
    • Member
      13 point Member
    • antiflag
    • Member since 09-14-2009, 8:25 AM
    • Posts 32

    hi,

    i have three radio buttons....and a search button....

    atleast one of them should be checked for any search to go on....

    can required filled validator  be used so that atleast one of the radio buttons should be clicked inorder to search something or else it will show a pop up message....

    OR

    can anyone one tell me how to disable the error message in requiredfieldvalidator using javascript for certain conditions only...i only want  the code to disable the requiredfieldvalidator ...


    thank u very much..


  • Re: Use of Required filled validator

    11-04-2009, 10:13 AM
    • All-Star
      36,220 point All-Star
    • rtpHarry
    • Member since 10-01-2006, 8:51 AM
    • Lincoln, England
    • Posts 5,819

    You can put your three radio fields in a radiofieldlist control and use some code like I wrote in this thread:

  • Re: Use of Required filled validator

    11-04-2009, 10:14 AM
    • All-Star
      36,220 point All-Star
    • rtpHarry
    • Member since 10-01-2006, 8:51 AM
    • Lincoln, England
    • Posts 5,819

    You can manipulate the validators in javascript btw:

  • Re: Use of Required filled validator

    11-05-2009, 2:07 AM
    Answer

    antiflag:

    i have three radio buttons....and a search button....atleast one of them should be checked for any search to go on....

    can required filled validator  be used so that atleast one of the radio buttons should be clicked inorder to search something or else it will show a pop up message....

    Hi,

    Based on my understanding, you need to make the user at least select one item from the radio buttons group. If so, you can easily achieve this task by using a RadioButtonList and a RequiredFieldValidator.

    I made a simple instance for you here. Please follow it and let me know if it works.

    <asp:RadioButtonList ID="RadioButtonList1" runat="server">
        <asp:ListItem>Item1</asp:ListItem>
        <asp:ListItem>Item2</asp:ListItem>
        <asp:ListItem>Item3</asp:ListItem>
    </asp:RadioButtonList>
    
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ErrorMessage="You need to select at least one item from the radio group"
                                ControlToValidate="RadioButtonList1">
    </asp:RequiredFieldValidator>
    <p />
    <asp:Button ID="Button1" runat="server" Text="Submit" />
    
    

    Best Regards,
    Shengqing Yang

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread : )
Page 1 of 1 (4 items)