The first one works... but it can only validate one specific element in a form, and I want to be able to set some parameters to check the other elements at the same time.
works
Code: Select all
function validate_form()
{
valid = true;
if ( document.form.title.value == "" )
{
alert ( "Du har inte fyllt i alla fälten" );
valid = false;
}
return valid;
}
Code: Select all
function validate_form_two (form, a, b)
{
valid = true;
if ( document.form.a.value == "" || document.form.b.value == "")
{
alert ( "Du har inte fyllt i alla fälten" );
valid = false;
}
return valid;
}