How to validate that at least one text box has input

Discussion in 'ASP .Net' started by Homer, Aug 29, 2007.

  1. Homer

    Homer Guest

    Hi,

    I've created a page that allows employee to change their personnel
    information, like name, marital status, address, etc. When the user
    clicks the Send button to send the change requests via email to HR, I
    want to make sure that at least one of the text boxes has input. For
    example, a user may only want HR to change his marital status and
    nothing else. In this case, validation should pass and an email is
    sent. However, if nothing is entered and the user clicks send, the
    send operation should not be executed and the user should be alerted
    that at least one change must be inputted before clicking send. I
    cannot use a validator control before if one control does not have
    input, the Page.IsValid would be set to False. Is there a way to do
    this?

    Thanks,
    Jon
     
    Homer, Aug 29, 2007
    #1
    1. Advertising

  2. You can use a CustomValidator. The client and server side validation
    functions should compare the new values with orignal value and set
    args.IsValid to true is at least one value is changed.

    "Homer" <> wrote in message
    news:...
    > Hi,
    >
    > I've created a page that allows employee to change their personnel
    > information, like name, marital status, address, etc. When the user
    > clicks the Send button to send the change requests via email to HR, I
    > want to make sure that at least one of the text boxes has input. For
    > example, a user may only want HR to change his marital status and
    > nothing else. In this case, validation should pass and an email is
    > sent. However, if nothing is entered and the user clicks send, the
    > send operation should not be executed and the user should be alerted
    > that at least one change must be inputted before clicking send. I
    > cannot use a validator control before if one control does not have
    > input, the Page.IsValid would be set to False. Is there a way to do
    > this?
    >
    > Thanks,
    > Jon
    >
     
    Sherif Elmetainy, Aug 29, 2007
    #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. Simon
    Replies:
    3
    Views:
    851
    Simon Harvey
    May 26, 2004
  2. cjl
    Replies:
    1
    Views:
    10,548
    Michael Winter
    Oct 31, 2005
  3. AAaron123
    Replies:
    0
    Views:
    648
    AAaron123
    Oct 3, 2008
  4. cjl
    Replies:
    7
    Views:
    213
    Thomas 'PointedEars' Lahn
    Oct 30, 2005
  5. Zvonko Bi¹kup

    Validate that at least one checkbox is checked

    Zvonko Bi¹kup, Mar 13, 2007, in forum: Javascript
    Replies:
    2
    Views:
    451
    -Lost
    Mar 13, 2007
Loading...

Share This Page