Forums

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? Reply To: How to validate 3 textboxes by showing only single error message?

#151366
Brad Metcalf
Participant

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!');
       }