1

My first attempt at asking this didn't go well. So, I am trying again, with hopefully more/better details.

I am running into this exact same problem:

RequiredFieldValidator have to click twice

RequiredFieldValidator requires user to click twice

When using a RequiredFieldValidator attached to a textbox, it is necessary to click twice to move focus to the next (or any) control. I understand the reason given in the above posts. But as one of the authors says, "I don't want to have to click twice". I've tried the suggestions in the post, but so far nothing is working.

Has anyone figured out another way to work around this?

I have tried:

  1. EnableClientScript="False"
  2. Display="Static" (had this already because it is my preference)
  3. Page.Validate(); and Page.Validate("vgPage04"); called from Page_Load (both IsPostBack and !IsPostBack)
  4. ErrorMessage and Text properties are populated
  5. Placing the ErrorMessage in both the property and between the tags
  6. CausesValidation="true" on the textbox
  7. Using a regular ASP.NET textbox instead of Telerik RadTextBox
  8. I do not have a CompareValidator
  9. A CustomValidator using server validation has the same problem
  10. A CustomValidator using client validation causes a different problem, so I don't want to go there

By design, it is allowable for the user to move to the next page of the application when there are invalid fields. Invalid fields need to be completed before a final submit on a subsequent page, but not to just move to the next page.

My code is as follows:

<telerik:RadTextBox ID="txtSample" runat="server" AutoPostBack="true"
         RenderMode="Lightweight" style="max-width:none;" 
         Resize="None" Width="330px" >
</telerik:RadTextBox>

<asp:RequiredFieldValidator ID="valSample" runat="server" 
     ControlToValidate="txtSample" ValidationGroup="vgPage04" 
     EnableClientScript="False" Display="Static" 
     CssClass="cssRF_splat"
     Text="*" ErrorMessage="Sample" >
</asp:RequiredFieldValidator>

On both IsPostBack and !IsPostBack, Page_Load calls

Page.Validate();

Thanks!

1
  • There's "field level validation"; and "record level" validation. Most apps, for better or worse, use record level; because it is "simpler". You can make record level easier by supplying defaults and "blasting" the user with only "one" error message at a time, and setting focus to the "biggest" problem. "Cross validation" becomes even more of a horror show if you're not up to it with "field level validation". Commented Jul 23 at 14:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.