I'm using javascript for my client validation and I would like this to work the way I wanted to. I have three textboxes for last name, middle name and firstname. All the fields are mandatory and if the form is submitted there would be an error to display below the textbox. The problem now is I couldn't show three errors at once. I could only show one error at a time. The error msgs are specific that is "Last name required", "First name required
Here's my JS structure
function validate()
{
if (textbox1 == empty)
{
//show error below textbox by using getElementById to the empty div below it
}
if (textbox2 == empty)
{
//show error
}
if (textbox3 == empty)
{
//show error
}
As you can see I'm using an if statement which only runs a block of code once regardless if the others is true. Now, how to show multiple errors at once?