It didn't paste the code Its below: <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="/CFIDE/scripts/cfform.js"></SCRIPT> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <!-- function _CF_checkaddsubctgry(_CF_this) {return submitform();
return true; } //--> </SCRIPT> <script language="JavaScript"> <!-- function submitform() { if (document.addsubctgry.subcatpic.value == "") { alert("You must enter a picture for this subcategory."); return false; } } // --> </script> <FORM NAME="addsubctgry" ACTION="adsbctac.cfm" METHOD="POST" onSubmit="return _CF_checkaddsubctgry(this)" ENCTYPE="multipart/form-data"> <input type="file" size="35" name="subcatpic"> <input type="submit"> </FORM> -----Original Message----- From: Mark Smyth [mailto:[EMAIL PROTECTED] Sent: 12 August 2004 17:58 To: '[EMAIL PROTECTED]' Subject: RE: [ cf-dev ] js drives me mad But this is weird, cause this (below) works also and I have seen it before where the onsubmit from the cfform conflicts with the bespokeley written one. But in this case it works, even when a required text field is entered. <script language="JavaScript"> <!-- function submitform() { if (document.addsubctgry.subcatpic.value == "") { alert("You must enter a picture for this subcategory."); return false; } } // --> </script> <cfform name="addsubctgry" action="adsbctac.cfm" enctype="multipart/form-data" onSubmit="return submitform();"> <input type="file" size="35" name="subcatpic"> <input type="submit"> </cfform> ----------------------------------------------------------- The interesting thing is the source code and its weird, look below. When the CFFORM is translated into HTML, the bespoke onsubmit is replaced by the CFFORM one. That was expected, what I didn't expect was that the CFFORM function calls the submitform() from within its own function. Wonders of cffform eh? Mark -- These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/ Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ CFDeveloper Sponsors and contributors:- *Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by activepdf.com* *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com* *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com* To unsubscribe, e-mail: [EMAIL PROTECTED] -- These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/ Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ CFDeveloper Sponsors and contributors:- *Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by activepdf.com* *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com* *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com* To unsubscribe, e-mail: [EMAIL PROTECTED]