Display message when RequiredFieldValidator fired

Discussion in 'ASP .Net' started by Christian Ista, Dec 6, 2004.

  1. Hello,

    I have a form with 5 textbox for each one a RequiredFieldValidator I show
    (*) if the field is missing when I post the form.

    I'd like when a least one of theses RequiredFieldValidator fired display an
    another message (other then ErrorMessage). Is there a way to do that ?

    Thanks,
     
    Christian Ista, Dec 6, 2004
    #1
    1. Advertising

  2. Christian Ista

    Scott M. Guest

    Which is it, you want an asterisk or a message, it can't be both.

    "Christian Ista" <> wrote in message
    news:...
    > Hello,
    >
    > I have a form with 5 textbox for each one a RequiredFieldValidator I show
    > (*) if the field is missing when I post the form.
    >
    > I'd like when a least one of theses RequiredFieldValidator fired display
    > an another message (other then ErrorMessage). Is there a way to do that ?
    >
    > Thanks,
    >
     
    Scott M., Dec 6, 2004
    #2
    1. Advertising

  3. I suggest you display the asterisk next to all the required fields to begin
    with in order to "pre-indicate" which fields are required. That's common
    practice these days.

    Ray at work

    "Christian Ista" <> wrote in message
    news:...
    > Hello,
    >
    > I have a form with 5 textbox for each one a RequiredFieldValidator I show
    > (*) if the field is missing when I post the form.
    >
    > I'd like when a least one of theses RequiredFieldValidator fired display

    an
    > another message (other then ErrorMessage). Is there a way to do that ?
    >
    > Thanks,
    >
    >
     
    Ray Costanzo [MVP], Dec 6, 2004
    #3

  4. > Which is it, you want an asterisk or a message, it can't be both.


    That's the point, I'd like both.

    An asterisk is displayed next to the field and I'd like an another comment
    in an another location.

    Thanks,
     
    Christian Ista, Dec 6, 2004
    #4
  5. Christian Ista

    Curt_C [MVP] Guest

    Set the text (between the <> and </>) to * and the Error message to "blah".
    Then drop on the summary and on the validator set the Display=Static

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    Site: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "Christian Ista" <> wrote in message
    news:O57pc$...
    >
    >> Which is it, you want an asterisk or a message, it can't be both.

    >
    > That's the point, I'd like both.
    >
    > An asterisk is displayed next to the field and I'd like an another comment
    > in an another location.
    >
    > Thanks,
    >
     
    Curt_C [MVP], Dec 6, 2004
    #5
  6. So, you'd like to have an * next to the textbox, but a more helpful error
    message somewhere else? That can be accomplished.

    The RequiredFieldValidator (as well as the other Validation controls) have
    two properties you should be interested in. The first is the ErrorMessage
    property, and the second is the Text property. Set the ErrorMessage property
    to "This field is required", and the Text property to "*". Then, add a
    ValidationSummary control to the top of your form.

    If validation errors occur, the Text property ("*") will be the one
    displayed next to the TextBox, while the ErrorMessage property will be the
    one displayed in the ValidationSummary control.

    Hope this helps,
    Johann MacDonagh

    "Christian Ista" <> wrote in message
    news:...
    > Hello,
    >
    > I have a form with 5 textbox for each one a RequiredFieldValidator I show
    > (*) if the field is missing when I post the form.
    >
    > I'd like when a least one of theses RequiredFieldValidator fired display
    > an another message (other then ErrorMessage). Is there a way to do that ?
    >
    > Thanks,
    >
     
    Johann MacDonagh, Dec 7, 2004
    #6
    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. Peter Blum
    Replies:
    0
    Views:
    1,131
    Peter Blum
    Feb 25, 2004
  2. James
    Replies:
    4
    Views:
    7,148
    James
    Aug 17, 2004
  3. Vik
    Replies:
    2
    Views:
    1,040
  4. Next
    Replies:
    1
    Views:
    451
    Alvin Bruney
    Nov 19, 2003
  5. Norm

    RequiredFieldValidator: No message display.

    Norm, May 21, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    180
Loading...

Share This Page