QuackFuzed.com is the personal ColdFusion coding blog of Matt Quackenbush. It exists primarily as a place for the author to learn, and hopefully to assist others in learning and/or avoiding some of the same pitfalls and mistakes. (Quack certainly makes enough mistakes daily to make up for the entire ColdFusion community.)
Uni-Form XHTML Forms Custom Tags v2
Posted on June 2, 2008 at 12:39 AM in ColdFusion, Uni-Form Tag Library, jQuery
It's been almost six months now since I released v1 of the library, so I figured it was high time I make time to add some enhancements. Here's a quick overview of the new features:
- Integrated dependencies
- Integrated support for the following jQuery plugins
- Date Picker
- Time Entry
- Input Masking
- Validation
- Path Configuration
Let's look at some of the new goodies in more detail...
Latest Articles
- No recent entries.
Eventually something really brilliant and witty will appear right here.
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 6/2/08 at 6:34 AM, Tom K said:
One of the first things I did was put the JS on cfhtmlhead on the form tag :)
i'm still trying to work out how to make a dropdown filled from a query though :(
On 6/2/08 at 7:32 AM, Sebastiaan said:
On 6/2/08 at 2:02 PM, Matt Quackenbush said:
On 6/2/08 at 2:07 PM, Matt Quackenbush said:
<uform:field label="My Label" name="fieldname" isRequired="true" type="select">
<cfloop query="myQuery">
<uform:option display="#myQuery.myDisplayField[currentRow]#"
value="#myQuery.myValueField[currentRow]#"
isSelected="#myQuery.myValueField[currentRow] EQ form.fieldname#" />
</cfloop>
</uform:field>
On 6/2/08 at 6:05 PM, Jonathan van Zuijlekom said:
On 6/3/08 at 5:59 AM, Tom K said:
- Thanks - I didn't really think that I could do a conditional statement in this syntax:
ischecked="#form.ispublic EQ 1#" etc..
That solves a lot of my "hacking"!
On 6/4/08 at 6:38 PM, Dan said:
Also, is there a way to generate a multiple select box?
On 6/4/08 at 6:57 PM, Matt Quackenbush said:
Multiple select is not currently supported as-is. I have added it to the feature requests for the next round of updates. :-)
On 6/4/08 at 7:27 PM, Dan said:
##newsletter:checked
##newsletter-1:checked
$('newsletter').checked
$('newsletter-1').checked
The newsletter checkbox and email field combination are common on our site and we also are hoping to make a state/province dropdown required if the user chooses USA, otherwise if they choose any other country a "Other State/Province" text box magically appears and the state/province dropdown disappears.
You can check out an example at http://www.akextremeadventures.com/make_reservatio.... If you choose USA, Canada or Australia you then must choose from the state/province dropdown. Otherwise you get a text box. Of course, these forms took a lot of time to design and write the JS code, which is why I'm looking into your Uni-Form tag.
Here is the code just in case I did something dumb.
<div class="formContainer">
<!--- build the form --->
<uform:form action="action.cfm"
id="myForm"
submitValue="Send"
showCancel="false"
loadValidation="true"
loadjQuery="true">
<uform:fieldset legend="Your Info">
<uform:field label="Name"
name="name"
isRequired="true"
type="text"
validation="required" />
<uform:field label="Newsletter Sign Up" isRequired="true" validation="required" name="newsletter" type="checkboxgroup">
<uform:checkbox label="Yes I want to sign up for the newsletter" value="email" />
</uform:field>
<uform:field label="Email Address"
name="email"
isRequired="true"
type="text"
validation="$('newsletter-1').checked email" />
</uform:fieldset>
</uform:form>
</div>
Thanks,
Dan
On 6/4/08 at 7:43 PM, Matt Quackenbush said:
It appears that I need to add a couple more things to the validation support in order to handle rules. As-is it will handle only the simple validations that are built-in to the plugin. It will be a little bit before I can take a good look at it, but I *think* it should be something I can bang out pretty quickly once I get a second to look into it. Hopefully I'll be able to do so in the next week or so.
In the meantime, you (or anyone else) should be able to write your rules externally (in a <script> block as you normally would), and also externally load the validation script that comes with the download. This should still allow full integration with the Uni-Form markup, with minimal extra code.
On 6/4/08 at 7:47 PM, Dan said:
Thanks again for the prompt response and cool new tool.
Dan
On 6/5/08 at 5:05 PM, Dan said:
window.onload = function() {
$("#contactEmail").rules("add", {
required: "#newsletter-1:checked",
email: true
});
}
On 6/5/08 at 5:11 PM, Matt Quackenbush said:
1) try this for your function...
$(document).ready(function() {
$("#contactEmail").rules("add", {
required: "#newsletter-1:checked",
email: true
});
});
2) the isRequired argument on the tag should have zero affect on your validation routines. All it does (if set to true) is place the * next to the field, denoting it as being required.
On 6/5/08 at 6:30 PM, Dan said:
On 6/10/08 at 9:28 PM, Jim Priest said:
On 6/11/08 at 4:00 PM, Matt Quackenbush said:
On 6/12/08 at 11:45 AM, Matt MacDougall said:
-Matt
On 6/12/08 at 2:55 PM, Matt Quackenbush said:
On 2/3/09 at 12:11 PM, George said:
I am not getting any errors. I am getting four select boxes when I was only expecting 2 and when I select the first box the on change event never fires to load the second box.
On 2/3/09 at 8:11 PM, Matt Quackenbush said:
<script>
// load cities based upon the state
$(function () {
var state = $('#state');
var city = $('#city');
state.selectChain({
target: city,
url: '<cfoutput>#xit.loadCitiesByState#</cfoutput>',
type: 'post',
key: 'city',
selectedValue: '<cfoutput>#address.getCity()#</cfoutput>',
data: { ajax: true, anotherval: "anotherAction" }
}).trigger('change');
});
</script>
<uform:field label="State" name="state" type="select" isRequired="yes">
<uform:states-us fieldName="state" struct="#event.getCollection()#" defaultState="#address.getState()#" />
</uform:field>
<uform:field label="City" name="city" type="select" isRequired="yes">
<option value="">-- Select State First --</option>
</uform:field>
Plugin Link: http://remysharp.com/2007/09/18/auto-populate-mult...
On 2/4/09 at 8:53 AM, George said:
Why did you use this in the first select uform:states-us? Was it because this field type was setup to take a struct as a parameter? And finally, what is going on with
data: ajax: true, anotherval: anotherAction
On 2/4/09 at 4:31 PM, Matt Quackenbush said:
I'm not sure what you're asking about with the uform:states-us question.