On Aug 27, 2008, at 12:23 PM, David Holt wrote:
Hi Chuck,
Thanks for the reply. The only table is a list of variables to hold checkbox values.
T_Group
------------
pk id integer
member integer
isHappy integer
isFull integer
etc.
The labels are in html.
I guess what I am asking is where I can apply logic to the checkbox bindings to make them correlate to a string binding? The label needs to point to a variable value, not a value, if that makes sense.
Not at all, really.
i.e. for variable "member" display string related to member "The group allows membership"
for variable "isHappy" display string related to isHappy "The group is a happy group"
Please don't give me grief for my "parable" variables ;-)
Me? I would never do that!
I was thinking of something like a LabelledCheckbox component:
<wo:LabelledCheckbox name = "member" eo = "$aGroup" />
which would generate:
<wo:checkbox name = "member" value = "1" selection = "$selection" /> <wo:string value="$label" />
value comes from eo.valueForKey(valueForBinding("name")))
selection/setSelection wrap eo.valueForKey(valueForBinding("name"))) / eo.setValueForKey(newValue, valueForBinding("name")))
label finds the entity for T_Group, gets entity.attributeNamed(valueForBinding("name")) and then pulls the label text out of attribute.userInfo().valueForKey("label") if you want it from the EOModel or uses labelEO.valueForKey(valueForBinding("name"))) if you want it in the database.
Is that making any sense?
Chuck
On 27-Aug-08, at 11:51 AM, Chuck Hill wrote:
On Aug 27, 2008, at 11:36 AM, David Holt wrote:
Hi all,
I have a form with many wo:checkboxes. I would like to store the labels for the checkboxes in the database instead of hardcoding them in the html. Is there a way I can tie a specific checkbox to a unique value in a table of labels? For example:
<wo:checkbox name = "member" value = "1" selection = "$aGroup.member" /> <wo:string value= ??? />
I think you would want a custom component that contained this or maybe the entire radio group? The component would have the logic to find the label. I can't be more specific without knowing your database setup.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.