Jump to content

Submit Form - Drop down menu "required field" - NEED HELP......


sinernational

Recommended Posts

Hi

 

You are attempting to use Javascript to check (so probably should be in the Javascript forum). While it can be useful you need to check in php as well.

 

Probably best to check the selectedIndex of the select drop down.

 

All the best

 

Keith

You could use somethign like this:

 

<form action="page.php" method="post" enctype="multipart/form-data" name="form_id" id="form_id">
<script language='javascript' type='text/javascript'>
form_id = function()
{
if(document.getElementById('jurisdiction').value == '')
{
alert('Enter your text here.');
document.getElementById('jurisdiction').focus();
document.getElementById('jurisdiction').select();
return false;
}
else
{
return true;
}
}
document.getElementById('form_id').onsubmit = form_id;
</script>
// Form continues here

 

changing "form_id" for your form name and the alert to whatever you want it to be

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.