form:checkbox seems not to bind

1 view
Skip to first unread message

Mike Rogers

unread,
Nov 7, 2009, 3:15:56 PM11/7/09
to Mach-II for CFML
All,

Has anyone played with <form:checkbox>? I have a decorator on a
TransferObject that seems never to be called. My view:

<label for="educationFormatString">Education Format</label>
<cfloop query="educationFormatQuery">
<form:checkbox path="educationFormatString"
value="#educationFormatQuery.id#"/>#educationFormatQuery.format#
</cfloop>

My decorator method (this TransferObject is being used as an event-
bean, and all non-checkbox fields are binding correctly through
decorator methods):

<cffunction name="setEducationFormatString" returntype="void"
output="false">
<cfargument name="educationFormatString" type="string"
required="true"/>
<cfset var array = ListToArray(arguments.educationFormatString)/>
<cfthrow message="educationFormatString:
#arguments.educationFormatString#"/>
<cfset clearEducationFormats()/>
<cfloop from="1" to="#ArrayLen(array)#" index="i">
<cfset addEducationFormats(getTransfer().get
("gorgon.EducationFormat", array[i]))/>
</cfloop>
</cffunction>

The CFTHROW command on line 4 in the decorator method is never getting
called.

Does anyone have a clue where I've gone wrong? Did I find a bug?

Thanks,

-Mike Rogers

Peter J. Farrell

unread,
Nov 7, 2009, 3:39:56 PM11/7/09
to mach-ii-for...@googlegroups.com
What does your <form:form> tag or <form:bind> tag look like? I suspect
the form is bound to the Event object and not bound to your object. Our
test in the test harness for checkbox is working -- so I suspect a
simple configuration issue we're not seeing.

Best,
.Peter

Mike Rogers said the following on 11/07/2009 02:15 PM:

Peter J. Farrell

unread,
Nov 7, 2009, 5:21:57 PM11/7/09
to mach-ii-for...@googlegroups.com
One thought on this is do you have a matching getter called
getEducationFormatString()? I'm pretty sure we look for a get* when
introspecting the metadata. It is how it was setup years ago by the
original Mach-II developers so changing it to look for setters as well I
believe would break backwards compatibility. Also we don't walk the
inheritance chain of the component either so if the getter is inherited
-- it's won't get picked up either. We may have to consider and walk
the inheritance chain though.

.pjf

Mike Rogers said the following on 11/07/2009 02:15 PM:

Mike Rogers

unread,
Nov 7, 2009, 5:18:09 PM11/7/09
to Mach-II for CFML
False alarm. I forgot to add that particular form element to the
'fields' collection in the event-bean.

Thanks for your help!

-Mike

Peter J. Farrell

unread,
Nov 7, 2009, 5:41:45 PM11/7/09
to mach-ii-for...@googlegroups.com
Mike Rogers said the following on 11/07/2009 04:18 PM:

> False alarm. I forgot to add that particular form element to the
> 'fields' collection in the event-bean.
>
Awesome. Glad it all worked out. You could also use the `autopopulate`
attribute if you don't want to list all the fields you want to populte.
See the XML configuration reference for more information:

http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/wiki/ConfigFileExplained#event-bean

Best,
.Peter

P.s. FYI, your question did cause be to find Ticket #426 which I just
fixed in the BER. Kudos and thanks for you help!

http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/ticket/426

Reply all
Reply to author
Forward
0 new messages