<!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 5.00.2919.6307" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face="Times New Roman">
<P>Any idea how I can get 2 functions to work on the same onclick event? </P>
<P>The first function is a modified Dreamweaver validation script which uses
alert to pop up a window with information on which form fields have not been
completed.</P>
<P>If all fields are complete then it returns no alert window.</P></FONT><FONT
color=#800000 face="Courier New">
<P>function MM_validateForm() { //v4.0</P>
<P>var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;</P>
<P>for (i=0; i<(args.length-2); i+=3) { test=args[i+2];
val=MM_findObj(args[i]);</P>
<P>if (val) { nm=val.name; if ((val=val.value)!="") {</P>
<P>if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');</P>
<P>if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail
address.\n';</P>
<P>} else if (test!='R') {</P>
<P>if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';</P>
<P>if (test.indexOf('inRange') != -1) { p=test.indexOf(':');</P>
<P>min=test.substring(8,p); max=test.substring(p+1);</P>
<P>if (val<min || max<val) errors+='- '+nm+' must contain a number between
'+min+' and '+max+'.\n';</P>
<P>} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';
}</P>
<P>} if (errors) alert('The following error(s) occurred:\n'+errors);</P>
<P>document.MM_returnValue = (errors == '');</P>
<P>}</P></FONT><FONT face="Times New Roman">
<P>The second function submits the form information for processing to another
page I have.</P></FONT><FONT color=#800000 face="Courier New">
<P>function Save_onclick() {</P>
<P>SaveForm.Page.value = otherDoc.body.outerHTML;</P>
<P>SaveForm.submit();</P>
<P>}</P></FONT><FONT face="Times New Roman">
<P>Both functions work flawlessly by themselves.</P>
<P>However I want MM_validateForm() to be processed first and if it returns no
errors then I want Save_onclick() to run.</P>
<P>This only runs Save_onclick() and never gets to
MM_validateForm()</P></FONT><FONT color=#0000c0 face="Courier New">
<P><input type=</FONT><FONT color=#000000
face="Courier New">"button"</FONT><FONT color=#0000c0 face="Courier New">
value=</FONT><FONT color=#000000 face="Courier New">"Submit
Bulletin"</FONT><FONT color=#0000c0 face="Courier New"> name=</FONT><FONT
color=#000000 face="Courier New">"Save"</FONT><FONT color=#0000c0
face="Courier New"> LANGUAGE=</FONT><FONT color=#000000
face="Courier New">"javascript"</P></FONT><FONT color=#0000c0
face="Courier New">
<P>onclick=</FONT><FONT color=#000000 face="Courier New">"return
Save_onclick();MM_validateForm('ndate','','R','title','','R','printdate','','R','email','','R','moreinfo','','R');return
document.MM_returnValue"</FONT><FONT color=#0000c0 face="Courier New">></P>
<P>and this only runs </FONT><FONT color=#000000
face="Courier New">MM_validateForm() but doesn't run Save_onclick even if
MM_validateForm returns no errors.</P></FONT><FONT color=#0000c0
face="Courier New">
<P><input type=</FONT><FONT color=#000000
face="Courier New">"button"</FONT><FONT color=#0000c0 face="Courier New">
value=</FONT><FONT color=#000000 face="Courier New">"Submit
Bulletin"</FONT><FONT color=#0000c0 face="Courier New"> name=</FONT><FONT
color=#000000 face="Courier New">"Save"</FONT><FONT color=#0000c0
face="Courier New"> LANGUAGE=</FONT><FONT color=#000000
face="Courier New">"javascript"</P></FONT><FONT color=#0000c0
face="Courier New">
<P>onclick=</FONT><FONT color=#000000
face="Courier New">"MM_validateForm('ndate','','R','title','','R','printdate','','R','email','','R','moreinfo','','R');return
document.MM_returnValue;return Save_onclick()"</FONT><FONT color=#0000c0
face="Courier New" size=1><FONT size=3>></FONT></P>
<P><FONT size=3>I appreciate any assistance on how I write the syntax so that
MM_validateForm() runs first and if no error messages are generated then
Save_onclick() runs.</FONT></P>
<P><FONT size=3>Thanks so much</FONT>.</P></FONT></DIV></BODY></HTML>