Jump to content

[SOLVED] grr..."simple" form validation?


justravis

Recommended Posts

i'm just trying to check 1 select menu at this point...it doesnt even trigger

 

<script src='intro.js'></script>
<form method=post action=/programs/dmd/mentee/intro.pwr onSubmit='return validForm()'>
<input name=required id=required type=hidden value='chan,subchan'>
<label>How did you hear about Disability Mentoring Day?<br />
<select name='chan' onChange='showSubchan(this.value)'>
<option value=''>
	Please choose.
</option>
<option value=2>
	 San Diego Community College District
</option>

<option value=3>
	 San Diego Unified School District
</option>
</select>
<br />
<div id='selectSubchan'></div></label>
<input name=next id=next type=submit value=Next>
</form>

 

javascript

function validForm(form)
{
elem=document.getElementByID('chan');

if(elem.value == "Please Choose")
{
	alert(helperMsg);
	elem.focus();
	return false;
}
else
{
	return true;
}
}

 

Any thoughts?

 

THANK YOU!

Link to comment
Share on other sites

made a few corrections:

 

<script src='intro.js'></script>
<form method=post action=/programs/dmd/mentee/intro.pwr onSubmit='return validForm()'>
<input name=required id=required type=hidden value='chan,subchan'>
<label>How did you hear about Disability Mentoring Day?<br />
<select name='chan' onChange='showSubchan(this.value)'>
<option value=''>
	Please choose.
</option>
<option value=2>
	 San Diego Community College District
</option>

<option value=3>
	 San Diego Unified School District
</option>
</select>
<br />
<div id='selectSubchan'></div></label>
<input name=next id=next type=submit value=Next>
</form>

 

function validForm()
{
var elem=document.getElementById('chan');

if(!elem.value)
{
	alert('chan');
	elem.focus();
	return false;
}
else
{
	return true;
}
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.