Javascript form validation

They have: 32 posts

Joined: Jan 2001

I know nothing (very little) about Javascript.

I have four text boxes I want to make sure that at least one of them has input before they can submit a form. Any ideas?

Thanks!

Mike

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

if ((textbox1.value == "") && (textbox2.value == "") && (textbox3.value == "") && (textbox3.value == "")) {
  // hark, there is not user input!
}
'I'm not too good with making things cross browser (sorry), but this will give you a start.

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.