Forums

This topic is locked

Validating List/Menu Fields

Posted 08 Oct 2007 14:52:41
1
has voted
08 Oct 2007 14:52:41 Daniel Dunn posted:
In DW8, I have a Validate Form behavior on the submit button
of the form. In confuring the validations for the fields on the
form, no List/Menu fields appear. Any other type of field will
show up, text, multiline text, but no list/menus. How can I
get these to appear ar at least validate them? I hard coded
these fields with the others that do appear and can force
"Required" (See below). What happens when I code them in
is that the form will validate them, but will not recognize
that they have been filled in an erro messages that those
fields must be filled in when they already are.

Thanks,

Dan


*** APPEARS NEAR TOP OF FORM

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="" {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');

*** SUBMIT BUTTOM VALIDATION
<FONT FACE="Arial, Arial, Helvetica"><BR> </FONT><DIV ALIGN="center">
<FONT FACE="Arial, Arial, Helvetica"><INPUT NAME="Submit" TYPE="submit" onClick="MM_validateForm('your_name','','R','email_add','','R','csz','','R','phone','','R','dep_date_time','','R','dep_cit_ap','','R','numpass','','R','return_date','','R','address','','R','itinerary','','R','site_found','','R','car_req','','R','hotel_req','','R','ac_pref','','R','used_ornot','','R','how_respond','','R');return document.MM_returnValue" VALUE="Send Request">
<INPUT TYPE="reset" NAME="Reset2" VALUE="Reset Form"> <BR> </FONT></DIV></FORM><FORM NAME="form2" >
</FORM>

*** NOTE: from car_req on, validation is not working correctly

Reply to this topic