CFFORM/CFMX/IE

If you don’t use a submit button with CFFORM (under CFMX), but rather say a JavaScript ‘form.submit()’ call through a link, or image, or what-have-you, IE will submit the form, even if it fails the CF validation checks.

The solution, it turns out, is to copy the CFFORM-processing javascript that CF writes to your page, change the CFFORM to a regular form, and then call that script on the onclick, rather than form.submit(). It will then pass or fail as appropriate. Of course, this precludes your page from validating as, well, any version of HTML, as attributes such as ‘message’ and ‘required’ don’t exist for input tags. But oh well. If you’re forced.

Better yet would be to do server-side validation of forms, and just use the regular form tag, IMO, but sometimes your hand is forced.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: