Hi all,

Im trying to use a simple _javascript_ form validation with my CF code. The
validation should check both text fields and radio buttons/checkboxes. So
far the radio button part does not work. This is the code:

<script language='_javascript_'>
<!--
function check_form()
{
for (i = 0; i < document.forms[0].elements.length; i++)
{
checkElement = document.forms[0].elements[i];
if (checkElement.name == 'InstEthn') {if (checkElement.value.length > 255)
{ alert("text too long."); return false;} }
if (checkElement.name == 'InstLang') {if (checkElement.value.length > 255)
{ alert("text too long."); return false;} }
if (checkElement.name == 'InstEthn') {if (checkElement.value.length < 1) {
alert("The Instructor Ethnicity field is empty."); return false;}  }
if (checkElement.name == 'InstLang') {if (checkElement.value.group1 ==
undefined) { alert("Question 3 was not answered."); return false;}  }

As it is now, the "InstLang" field gives the user the "Question 3 was not
answered" message, even when that radio button is checked.

Any alternatives/fixes for this code?

Thanks a lot,

Roberto Perez
[EMAIL PROTECTED]
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to