<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Hi, I'm having trouble with the following two functions.&nbsp; 
They were generated by dreamweaver.&nbsp; The functions work together to 
validate a form.&nbsp; MM_validateForm() is called on submitting the form, 
and&nbsp;in turn calls MM_findObj, which takes a form input name passed to 
MM_validate form and returns the input object of that name.&nbsp; 
MM_validateForm() takes in parameters in triplets.&nbsp; For instance, if I had 
only one required parameter called 'Name', I would call 
MM_validateForm('Name','','R'), where R is the flag indicating the field is 
required.&nbsp; If I had 2 name fields I wanted to validate it would be 
</FONT></DIV>
<DIV><FONT size=2>MM_validateForm('Name1','','R','Name2','','R') and etc, 
inductively.&nbsp; I'm not sure what the second parameter in&nbsp;each triplet 
set is for.&nbsp; Anyway, there are two problems here.&nbsp; </FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>The first problem is that if one of the parameters I'm trying 
to require is a checkbox, the script looks at its value as though it was 
checked.&nbsp; IE if the value of the checkbox is 'yes' the script returns a 
'yes' regardless of whether the box was checked, and therefore the field is not 
made required.&nbsp; </FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>The second problem is that when I have a radio&nbsp;input the 
script considers the name and value of it to be undefined all the time.&nbsp; 
</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>I can write a simpler and more proprietary script for this but 
am pretty confused as to why this one is not working.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Does anyone have any ideas concerning this?</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Thanks,</FONT></DIV>
<DIV><FONT size=2>david.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>&lt;!--<BR>function MM_findObj(n, d) { //v4.0<BR>&nbsp; var 
p,i,x;&nbsp; if(!d) d=document; 
if((p=n.indexOf("?"))&gt;0&amp;&amp;parent.frames.length) 
{<BR>&nbsp;&nbsp;&nbsp; d=parent.frames[n.substring(p+1)].document; 
n=n.substring(0,p);}<BR>&nbsp; if(!(x=d[n])&amp;&amp;d.all) x=d.all[n]; for 
(i=0;!x&amp;&amp;i&lt;d.forms.length;i++) x=d.forms[i][n];<BR>&nbsp; 
for(i=0;!x&amp;&amp;d.layers&amp;&amp;i&lt;d.layers.length;i++) 
x=MM_findObj(n,d.layers[i].document);<BR>&nbsp; if(!x &amp;&amp; 
document.getElementById) x=document.getElementById(n); return 
x;<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>function MM_validateForm() { //v4.0<BR>&nbsp; var 
i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;<BR>&nbsp; 
for (i=0; i&lt;(args.length-2); i+=3) { test=args[i+2]; 
val=MM_findObj(args[i]);<BR>&nbsp;&nbsp;&nbsp; if (val) { nm=val.name; if 
((val=val.value)!="") {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
(test.indexOf('isEmail')!=-1) { 
p=val.indexOf('@');<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (p&lt;1 || 
p==(val.length-1)) errors+='- '+nm+' must contain an e-mail 
address.\n';<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else if (test!='R') 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (isNaN(val)) errors+='- 
'+nm+' must contain a number.\n';<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if (test.indexOf('inRange') != -1) { 
p=test.indexOf(':');<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
min=test.substring(8,p); 
max=test.substring(p+1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if (val&lt;min || max&lt;val) errors+='- '+nm+' must contain a number between 
'+min+' and '+max+'.\n';<BR>&nbsp;&nbsp;&nbsp; } } } else if (test.charAt(0) == 
'R') errors += '- '+nm+' is required.\n'; }<BR>&nbsp; } if (errors) alert('The 
following error(s) occurred:\n'+errors);<BR>&nbsp; document.MM_returnValue = 
(errors == '');<BR>}<BR>//--&gt;</FONT></DIV></BODY></HTML>