How can you reactivate validation controls without checking them immediately?

When I called this function to enable the validator from the javascript client:

`ValidatorEnable(document.getElementById('<%=valPassportOtherText.ClientID%>'), true); //enable`  validation control

the necessary control control element immediately performed its verification, found the value in the corresponding text field to be empty and set the focus to the text field (since SetFocusOnError was set to true). As a result, a side effect was that the focus was shifted to the control associated with the verification control, for example, txtSpecifyOccupation.

                          <asp:TextBox ID="txtSpecifyOccupation" runat="server" AutoCompleteType="Disabled"
                                        CssClass="DefaultTextBox DefaultWidth" MaxLength="24" Rows="2"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="valSpecifyOccupation" runat="server" ControlToValidate="txtSpecifyOccupation"
                                        ErrorMessage="1.14b Please specify your &lt;b&gt;Occupation&lt;/b&gt;" 
                                        SetFocusOnError="True">&nbsp;Required</asp:RequiredFieldValidator>

Perhaps there is a way to enable the (required) validator without performing a check at the same time (at least until the user selects it)?

, txtSpecifyOccupation txtSpecifyoccupation.

?

+3
1

ValidatorEnable. "" .

, innerText "".

0

Source: https://habr.com/ru/post/1743602/


All Articles