How to run validator from javascript?
- by David Shochet
Here is a part of my code:
<asp:ListBox ID="lbRD" runat="server" DataSourceID="RDSqlDataSource" onchange="JSFillDetail();" DataTextField="????????" DataValueField="ID" Width="188px" Height="200px"/>
<asp:TextBox ID="txtDescription" runat="server" />
<asp:RequiredFieldValidator ID="txtDescriptionRequiredFieldValidator" runat="server" ErrorMessage="???????? ???????? ???????????? ??? ??????????" ControlToValidate="txtDescription" />
I have a listbox, a textbox and a required field validator on my page. When the user selects something from the listbox, the selected item appears in the textbox using a javascript function. When the page is submitted, the validator reports an error in case the textbox is empty. If after that the user selects something from the listbox, the error message is still displayed, even though the textbox is not empty anymore. How can I make the validator validate the textbox, or even better, to clear the error message from the javascript function that fills the textbox?
Thanks, David