Ok, you're talking stylistic sense and I agree, but with respect, it's a bit academic in this instance, and nothing to do with why the JS is kicking off an Object Expected error.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 29 June 2004 15:12 To: [EMAIL PROTECTED] Subject: RE: [ cf-dev ] cfform[Scanned] you're usually better to have Javascript functions in the head of your document, so that they load in before the page starts to render. If it's stuff where you actually want to use Javascript to render the content (e.g. with some document.writeln commands), then obviously that should be in the document body. "Rich Wild" <[EMAIL PROTECTED] To: <[EMAIL PROTECTED]> group.com> cc: Subject: RE: [ cf-dev ] cfform[Scanned] 29/06/2004 14:59 Please respond to dev " Your bit of script chkRevision should ideally be in the <head> of your document, not just above the form." Why? I've never experienced this before. You can have a script wherever you like. -----Original Message----- From: Rich Wild [mailto:[EMAIL PROTECTED] Sent: 29 June 2004 14:57 To: [EMAIL PROTECTED] Subject: RE: [ cf-dev ] cfform[Scanned] Yup. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 29 June 2004 14:56 To: [EMAIL PROTECTED] Subject: Re: [ cf-dev ] cfform[Scanned] Are you sure you've got the fields 'revision' and 'EditComments' in your form, with the same-case spelling? Your bit of script chkRevision should ideally be in the <head> of your document, not just above the form. "Rich Wild" <[EMAIL PROTECTED] To: <[EMAIL PROTECTED]> group.com> cc: Subject: [ cf-dev ] cfform 29/06/2004 14:47 Please respond to dev Yuck. I've inherited code which I'm debugging and it all uses cfform, a personal peeve of mine. Now, perhaps its because I came back from Glastonbury yesterday and so am a little bit mental, but I'm trying to get this cfform to fire off a validation script on submit. So I've added the onsubmit parameter to the cfform call like thus: <cfform action="index.cfm?fuseaction=act_itemsteps&step=1" method="POST" name="itemFrm" enctype="multipart/form-data" onsubmit="return chkRevision ();"> And I have the following function declared just above it like thus: <script> function chkRevision() { if (document.itemFrm.revision.value && !document.itemFrm.EditComments.value.length) { alert('Warning!\n\nPlease ensure that you have completed the \'Edit Comments\' field.'); return false } else { return true } } </script> That should work yea? So why does the JS give me a Object Not Found error when run at the browser on this line (which is obviously created by cfform) function _CF_checkitemFrm(_CF_this) { if (!_CF_hasValue(_CF_this.title, "TEXT" )) { if (!_CF_onError(_CF_this, _CF_this.title, _CF_this.title.value, "Please enter Title")) { return false; } } return chkRevision(); return true; } p.s. I *would* dearly love to turn the whole form into a normal form, but there's a lot of work required (large form) to do that and this is a quick fix, very unfortunately. I think I've left my mind in a field. Ta everyone. Rich -- 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] -- 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] -- 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]
