Bruce Gust
asked on
Javascript validation for select box
I can't get this to work on a select box:
<script>
function validate()
{
if( document.myForm.url.value == "" )
{
alert( "Please provide a url!" );
document.myForm.url.focus( ) ;
return false;
}
if( document.myForm.link_type. value == "" )
{
alert( "Please provide a link type!" );
document.myForm.link_type. focus() ;
return false;
}
return(true);
}
</script>
"link_type" is
<select name="link_type">
<option></option>
<option>facebook</option>
<option>myspace</option>
</select>
I've been playing around with different options, but I can't get anything to work.
Thoughts?
<script>
function validate()
{
if( document.myForm.url.value == "" )
{
alert( "Please provide a url!" );
document.myForm.url.focus(
return false;
}
if( document.myForm.link_type.
{
alert( "Please provide a link type!" );
document.myForm.link_type.
return false;
}
return(true);
}
</script>
"link_type" is
<select name="link_type">
<option></option>
<option>facebook</option>
<option>myspace</option>
</select>
I've been playing around with different options, but I can't get anything to work.
Thoughts?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Good luck with your project!
Glad to help. Good luck.
ASKER
Thank you so much!