cfUniForm v3.3 - Client-Side Cancel Redirect and Cancel Button Bug Fix
Posted on February 27, 2009 at 7:34 AM in Uni-Form Tag Library
One of the questions that I have been asked repeatedly is
"Why does the cancel button still submit the form?"
Well, as of today, you have the option of changing that behavior.
New Feature: The cancelAction Attribute
You can now pass a URL to cfUniForm via the brand new 'cancelAction' attribute. You may pass a full URL, like so...
- <uform:form action="#cgi.script_name#"
- id="myDemoForm"
- cancelAction="http://www.domain.com/index.cfm">
... or you may pass just a file name, like so...
- <uform:form action="#cgi.script_name#"
- id="myDemoForm"
- cancelAction="index.cfm">
If a value is passed, cfUniForm will add it to the rendered JavaScript so that a click of the cancel button will redirect client-side, skipping the default action. It should be noted that this is handled by setting the window.location.href, so if you provide an invalid value, you'll probably end up with some rather strange behavior.
Bug Fix: Cancel Button + Validation
When validation rules were added via the validationSetup attribute, clicking the cancel button would still cause validation routines to run. This bug has been fixed, and the cancel button now bypasses validation.
As always, be sure to download the latest and visit the cfUniForm demos.
Latest Articles
- No recent entries.
Categories
- ColdBox (21) [RSS]
- ColdFusion (92) [RSS]
- Fusebox (3) [RSS]
- General (22) [RSS]
- jQuery (15) [RSS]
- Kalendar (1) [RSS]
- Linux (1) [RSS]
- Mura CMS (1) [RSS]
- Railo (1) [RSS]
- Rants (5) [RSS]
- Transfer (8) [RSS]
- Uni-Form Tag Library (36) [RSS]



On 3/2/09 at 2:51 PM, Mary Jo said:
On 3/3/09 at 5:26 AM, John said:
It could be cool if you can format the value in a text field with HTMLEditFormat to prevent XSS attacks.
cfinput does this no ?
On 3/3/09 at 5:52 AM, Matt Quackenbush said:
@ John - First of all, cfUniForm does not use cfform or any of the cfform-related tags.
As far as HTMLEditFormat() goes, in my opinion that is not the responsibility of a form library. Some forms should allow HTML and/or JavaScript to be entered, and some should not. As a matter of fact, I have a number of forms in various projects that allow HTML and/or JavaScript in some fields but not in others. I leave that decision up to the developer since only they know the requirements for the application that they are building.
In my applications I typically handle this by having a UDF that goes through the fields that don't allow HTML/JavaScript, and strips out any and all offending items. As far as I am concerned, if the field does not allow it, then entering
<script> // bad stuff here </script>
into my database is equally as bad as entering the real thing. I don't want any of it, so I strip it in its entirety.
On 3/3/09 at 5:56 AM, Matt Quackenbush said:
this.scriptProtect = true
If you're using Application.cfm, then add the scriptprotect="true" to the cfapplication tag.
On 3/3/09 at 9:05 AM, Scott Stroz said:
I am starting on a project that will be using uniForm with jQuery UI, specifically the dialogs. On forms that are being displayed in the dialog, the 'cancel' button woudl need to close the dialog rather than redirect to a URL.
On 3/3/09 at 5:04 PM, Matt Quackenbush said:
1) Do not use the 'cancelAction' attribute, and insert a <script> after the closing </uform:form> tag that adds the close trigger to the cancel button.
2) Use showCancel="false" and add a text close trigger to the markup.
HTH
On 4/3/09 at 8:15 AM, dickbob said:
I have "view" pages where only a cancel button is appropriate.
On 4/3/09 at 10:33 AM, dickbob said:
I might have a go a changing the logic and submit the change back to you Matt.
On 4/3/09 at 2:56 PM, David said:
On 4/4/09 at 12:06 AM, Matt Quackenbush said:
@ David - Sure. I use jQuery. Everything is selected by ID or class. In other words, I don't use and never will use a form name again, so I didn't include it. :-)
On 4/9/09 at 10:51 AM, dickbob said:
In the meanwhile I'll investigate your suggestions.
On 5/4/09 at 12:42 PM, Steve Weyrick said:
On 9/8/11 at 6:58 PM, erik said:
On 9/8/11 at 9:43 PM, Matt Quackenbush said:
On 9/8/11 at 11:39 PM, erik said: