The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to validate 3 textboxes by showing only single error message?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #151259

    i want trying to validate 3 textboxes (day, month, and year).
    either one of it if empty, then show a single error message even there is 2 empty i also show only a single error message. But how can i do that?
    i had tried many methods but i still unable to solve the problem.
    Thanks for in advanced.

    Brad Metcalf

    Kinda having trouble figuring out what exacty you mean in the second sentence. But if you want to just have one error if one of those is null then try this. Obviously var (string) = (input) for day month and year first.

           if (!day || !month || !year ) {
                  alert('This isn't right!');
           } else {
                  alert('Seems legit!');

    I am using ASP.NET to develop my web page,
    And inside one page have 3 differently textboxes which representing the day, month, and year respectively.
    Now i am going to validate 3 of them, no matter which textbox has incorrect data input.
    Which mean i am trying to validate 3 textboxes by only showing 1 error message.
    Thanks for in advance.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.