googlehelper
Feb 20th 2009, 12:34 am
<!-- JavaScript -->
<script type='text/javascript'>
function validate(form)
{
var flen = document.getElementById('F1').value.length;
var llen = document.getElementById('f2').value.length;
if (flen<3||llen<1)
{
alert('Error : Enter a valid Name.Enter your initials if you dont have a last name');
return false;
}
return true;
}
</script>
<!-- JavaScript End-->
<form id='form' name='join' class='joinform' enctype='multipart/form-data'
method='post' onsubmit='return(validate(this));' autocomplete='off' >
<ul>
<li id='fg0'>
<label class='desc' >Name<span class='req'>*</span></label>
<span><select id='F0' name='sex' tabindex='2' >
<option value='0' selected='selected'> Title </option>
<option value='m'>Mr</option> <option value='f'>Ms</option>
</select>
<label for='F1'>Title</label></span>
<span><input id='F1' name='fnam' type='text' maxlength='15' size='8' tabindex='3' />
<label for='F1'>First</label></span>
<span><input id='F2' name='lnam' type='text' maxlength='15' size='12' tabindex='4' />
<label for='F2'>Last</label></span>
</li>
........................................
.................................
Debug this code i dont get any alerts
<script type='text/javascript'>
function validate(form)
{
var flen = document.getElementById('F1').value.length;
var llen = document.getElementById('f2').value.length;
if (flen<3||llen<1)
{
alert('Error : Enter a valid Name.Enter your initials if you dont have a last name');
return false;
}
return true;
}
</script>
<!-- JavaScript End-->
<form id='form' name='join' class='joinform' enctype='multipart/form-data'
method='post' onsubmit='return(validate(this));' autocomplete='off' >
<ul>
<li id='fg0'>
<label class='desc' >Name<span class='req'>*</span></label>
<span><select id='F0' name='sex' tabindex='2' >
<option value='0' selected='selected'> Title </option>
<option value='m'>Mr</option> <option value='f'>Ms</option>
</select>
<label for='F1'>Title</label></span>
<span><input id='F1' name='fnam' type='text' maxlength='15' size='8' tabindex='3' />
<label for='F1'>First</label></span>
<span><input id='F2' name='lnam' type='text' maxlength='15' size='12' tabindex='4' />
<label for='F2'>Last</label></span>
</li>
........................................
.................................
Debug this code i dont get any alerts