O
Openside
Hi,
I am fairly green when it comes to JavaScript. I have the Form
Validation below for 3 textarea fields. It works fine, but if none of
the fields are filled out then 3 consequtive alert boxes pop up.How can
I modify the script to only prompt the user one field at a time?
The Script I have is:
<script language="JavaScript">
<!--
function valform ( )
{
valid = true;
if ( document.recipeform.directions.value == "" )
{
alert ( "Please enter the directions of the recipe." );
valid = false;
}
if ( document.recipeform.description.value == "" )
{
alert ( "Please enter the description of the recipe." );
valid = false;
}
if ( document.recipeform.ingredients.value == "" )
{
alert ( "Please enter the ingredients of the recipe." );
valid = false;
}
return valid;
}
//-->
</script>
thanks,
Openside
I am fairly green when it comes to JavaScript. I have the Form
Validation below for 3 textarea fields. It works fine, but if none of
the fields are filled out then 3 consequtive alert boxes pop up.How can
I modify the script to only prompt the user one field at a time?
The Script I have is:
<script language="JavaScript">
<!--
function valform ( )
{
valid = true;
if ( document.recipeform.directions.value == "" )
{
alert ( "Please enter the directions of the recipe." );
valid = false;
}
if ( document.recipeform.description.value == "" )
{
alert ( "Please enter the description of the recipe." );
valid = false;
}
if ( document.recipeform.ingredients.value == "" )
{
alert ( "Please enter the ingredients of the recipe." );
valid = false;
}
return valid;
}
//-->
</script>
thanks,
Openside