rivkamak
asked on
Adding a select box to Dreamweavers default verify function
Under the tag inspector section in Dreamweaver I set up to verify my form.
It only works with text boxes.
Is there a way to add a select box to the equation?
It only works with text boxes.
Is there a way to add a select box to the equation?
function MM_validateForm() { //v4.0
if (document.getElementById){
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=document.getElementById(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 == '');
} }
<input name="button" type="submit" id="button" style="background-color:#FF0; color:#006" onclick="MM_validateForm('Name','','R','Address','','R','Zip Code','','R','Email','','RisEmail','Electric Company','','R','Electric Account','','R','Gas Company','','R','Gas Account','','R');return document.MM_returnValue" value="Submit"/>
Don't use the old Javascript validation behaviors anymore. Those are only in there for compatibility. Use Spry Validation instead.
ASKER
but the problem with spry validation you just see next to input box and when I have a long form, and you hit submit, you don't see the red information on the top box.
ASKER
I'm looking for a pop up box.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.