something about RequiredValidator

Discussion in 'ASP .Net Web Controls' started by Kenny M., Jan 10, 2005.

  1. Kenny M.

    Kenny M. Guest

    I have a textBoxt associated to a RequiredFieldValidator and a Button

    When the textbox is empty and I click the button the validator works fine,
    but when the cursor is in the empty TextBoxt and I press Enter a PostBack is
    fired.

    Why the validator does not validate the empty TextBox in this case, and what
    should I do?


    --
    Ken
    Kenny M., Jan 10, 2005
    #1
    1. Advertising

  2. I agree that it's annoying that when a user presses the enter key, it
    doesn't always register as a button click event. Luckily you can fix this
    shortcoming.

    You could use this free control to solve the problem.
    http://www.metabuilders.com/tools/DefaultButtons.aspx

    And here are a couple good articles on the subject:
    http://www.allasp.net/enterkey.aspx
    http://www.aspnetpro.com/features/2004/06/asp200406so_f/asp200406so_f.asp

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net


    "Kenny M." <> wrote in message
    news:...
    >I have a textBoxt associated to a RequiredFieldValidator and a Button
    >
    > When the textbox is empty and I click the button the validator works fine,
    > but when the cursor is in the empty TextBoxt and I press Enter a PostBack
    > is
    > fired.
    >
    > Why the validator does not validate the empty TextBox in this case, and
    > what
    > should I do?
    >
    >
    > --
    > Ken
    Steve C. Orr [MVP, MCSD], Jan 10, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SStory

    requiredvalidator for checkbox

    SStory, Jul 30, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    1,350
    SStory
    Jul 30, 2003
  2. Elie Medeiros via .NET 247

    Custom Validator not working without RequiredValidator

    Elie Medeiros via .NET 247, May 18, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    8,668
    William F. Robertson, Jr.
    May 18, 2005
  3. TJS
    Replies:
    3
    Views:
    549
  4. tshad

    RequiredValidator not working

    tshad, May 20, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    2,013
    Peter Blum
    May 21, 2005
  5. Shimon Sim
    Replies:
    4
    Views:
    22,144
    Patrick.O.Ige
    Feb 3, 2006
Loading...

Share This Page