HighDots Forums  

MM_validateForm() arguments

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss MM_validateForm() arguments in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
gbalaguer
 
Posts: n/a

Default MM_validateForm() arguments - 07-09-2004 , 11:22 AM






What are the arguments for this function:

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args);
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 == '');
}


Dreamweaver uses it like this: onSubmit="MM_validateForm('name','','R')

'name' ---> is the field's name
'' --> this is what I don't know. I guess it could be to specify the type of
the field, and maybe allow to use the function with radiobuttons or checkboxes
'R' ----> indicates that the field is required


could anyone please help me with this? I'll be very thankful...


Reply With Quote
  #2  
Old   
~Angela, TMM
 
Posts: n/a

Default Re: MM_validateForm() arguments - 07-09-2004 , 01:15 PM







Quote:
'name' ---> is the field's name
'' --> this is what I don't know. I guess it could be to specify the type
of

If I recall correctly this argument is blank for compatibility with previous
versions of Dreamweaver. Macromedia doesn't remove the arguments, they just
insert empty strings instead. Usually a look at the Behavior files will give
you an idea about this; they're pretty good about adding comments in the
behavior files to indicate why they do things like this.

Hope that helps,
~Angela

--
Angela C. Buraglia, Founder:
~FAQs, Tutorials & Resources~ http://www.DreamweaverFAQ.com
~My Extensions~ http://www.dwfaq.com/go.asp?ID=AngelaX10
DWfaq Support Newsgroup: news://support.dwfaq.com/support

Co-Author with Joseph Lowery, Dreamweaver MX 2004 Killer Tips:
http://www.dwkillertips.com

Extension Developer for Cartweaver 2:
http://www.cartweaver.com/extensionsuite.cfm

Remove the CAPS in my E-mail to reply off list.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.