I'm using a custom script with CFFORM. When I include an onsubmit action in
CFFORM, it add this statement to the CFCODE.

 

}else {

            // run userdefined onSubmit javascript. 

            LimitAttach(this.form, this.form.file.value)

            return true;

        }

 

That's cool, so it run my script after is runs the CFVALIDATION. My script
is:

 

<script language="JavaScript">

                extArray = new Array('gif','swf');

                function LimitAttach(form, file) {

                allowSubmit = false;

                if (!file) return;

                while (file.indexOf("\\") != -1)

                file = file.slice(file.indexOf("\\") + 1);

                ext = file.slice(file.indexOf(".")).toLowerCase();

                for (var i = 0; i < extArray.length; i++) {

                if (extArray[i] == ext) { allowSubmit = true; break; }

                }

                if (allowSubmit) form.submit();

                else

                alert("Please only upload files that end in types: " 

                + (extArray.join("  ")) + "\nPlease select the "

                + "correct file type.");

                }

</script>

 

This checks for valid file types for an upload file. It works, but now after
it gives me the alert on wrong file types, it submits after clicking OK on
the alert. How do I get this to abort the submit after an alert?

 

Thanks

 

 

Robert B. Harrison
Director of Interactive services
Austin & Williams
125 Kennedy Drive, Suite 100 Hauppauge NY 11788
T : 631.231.6600 Ext. 119 

F : 631.434.7022
www.austin-williams.com

Great advertising can't be either/or... It must be &.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287447
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to