Snippet of my code:
<asp:ListBox ID="lbRD" runat="server" DataSourceID="RDSqlDataSource" onchange="JSFillDetail();" DataTextField="Description" DataValueField="ID" Width="188px" Height="200px"/>
<asp:TextBox ID="txtDescription" runat="server" />
<asp:RequiredFieldValidator ID="txtDescriptionRequiredFieldValidator" runat="server" ErrorMessage="Description is required" ControlToValidate="txtDescription" />
I am facing an issue with a listbox, textbox, and required field validator on my webpage. Upon selecting an item from the listbox, it is displayed in the textbox through a JavaScript function. However, when the form is submitted, if the textbox is empty, the validator correctly reports an error. The problem arises when a selection is made after the initial error, as the error message persists despite the textbox being populated. How can I ensure that the validator validates the textbox properly or even better, clear the error message using the JavaScript function that fills the textbox? Any help would be appreciated. Thank you, David.