Hi John, The following will run the JavaScript (which disables submit button, and displays the image) only if CF form validation passes:
<style> #myImageID {display:none;}/*hide image*/ </style> <script type="text/javascript"> /* <![CDATA[ */ var submitted = false; var imageID; function myFunction(frm, bttnID, imgID) { if (!submitted) { submitted = true; imageID = imgID; frm[bttnID].disabled = true; setTimeout('document.getElementById(imageID).style.display = "inline"', 100);//delay for IE return true; } else { return false;//disable 2+ submits } } /* ]]> */ </script> <cfform name="myForm" onsubmit="return myFunction(document.myForm, 'myButtonID', 'myImageID')" enctype="multipart/form-data"> <cfinput type="file" name="myField" value="" required="yes" /> <cfinput type="submit" name="myButtonID" value="click me" /> </cfform> <img id="myImageID" src="PleaseWait.gif" alt="Please Wait" /> The JS could be placed in an external script, but CF mixes its JS w/ XHTML.. (including generation of the form's onsubmit attribute, and placement of the JS call within). Credit, where credit is due: http://tutorial8.learncf.com Hope that helps!, -Aaron Neff > Good feedback. > > I am using the ColdFusion error checking of cfinput and cfselect to > validate the input in the form before processing. If I simply > JavaScript the button to either pop an image or inhibit the button, > would it trigger that even though the validation failed? > > I'd not want to have the situation where the validation failed but the > "working" icon or inactive button were left on the page. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333678 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm