How to run validator from javascript?
Posted
by
David Shochet
on Stack Overflow
See other posts from Stack Overflow
or by David Shochet
Published on 2011-11-22T20:55:38Z
Indexed on
2012/06/25
21:16 UTC
Read the original article
Hit count: 383
JavaScript
|ASP.NET
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
© Stack Overflow or respective owner