I'm not sure what it is you're trying to do here?  Setting a default in
the DB or TO is fine, but when you use makeEventBean() how can you
gaurantee that the checkbox is false because it is undefined.. Maybe it
was just absent from the form, and hence its value should not be
updated.

Doesn't the problem lie with the default behaviour of html checkboxes,
maybe using a select with "yes/no" options instead would be a solution?
If your checkboxes are in forms created by MG scaffolds, how about
updating the scaffold xsl's to use selects inplace of checkboxes.

Cheers, Chris

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Bob Silverberg
> Sent: 28 March 2007 19:02
> To: [email protected]
> Subject: [SPAM] RE: [Reactor for CF] Dealing with checkboxes 
> and bit fields
> 
> Thanks for the suggestions.  I have tried a number of variations which
> involved either adding code into a controller, a service 
> object or a reactor
> object.  Each of these techniques "worked", but I'd really 
> like to find a
> way to make this default behaviour for the entire app.  One 
> of my goals in
> moving towards a more OO programming style was to be able to 
> put rules like
> this in one place, rather than all over the application.
> 
> It seems like the only way I can do this is to add my own 
> code to a reactor
> core object.  I have come across this in another scenario 
> where I wanted to
> add something into the abstract record object (I need to set 
> a couple of
> values, and they are always set for every insert or update into every
> table).  Again, I couldn't figure out how to add this behaviour to all
> objects at once, instead of individually, other than editing 
> a core object.
> 
> Is there a way to do this?  I guess what I'm looking for is a 
> local version
> of the abstract objects (just like the local versions of the 
> other objects),
> but I understand why that won't work with the current 
> inheritance scheme.
> Has anyone else come across a situation in which they wanted 
> to do this?
> Did you find a way of doing it without adding to a core file?
> 
> Thanks,
> Bob
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Dinner
> Sent: March 26, 2007 3:24 PM
> To: [email protected]
> Subject: Re: [Reactor for CF] Dealing with checkboxes and bit fields
> 
> 
> There are several ways you could tackle this, the least of 
> which could be
> setting a default value in the database... cooler, maybe, 
> would be to use
> the record's transfer object, or perhaps add a generic 
> controller/ message
> that takes the field name as an argument, and does the magic there...
> 
> Really a bunch of different ways without having to dig into 
> the core...
> 
> Not sure how they compare in ease of use... that's up to 
> preference I guess?
> The "reactor" way will require an edit to each object that needs the
> "massaging", the MG way will need to broadcast a message 
> where ever you save
> one of those objects...
> 
> The reactor way would be best*, if not in the DB itself, as 
> then whenever
> you do something with the object you can expect it to behave 
> the same way.
> *maybe :-)
> 
> HIH!
> 
> On 3/26/07, Bob S wrote:
> > Hi all,
> >
> > I'm using Reactor with Model-Glue, and I'm using 
> makeEventBean() in my 
> > controller to grab all of the values from a submitted form 
> and place 
> > them into my reactor record object.  This works very well, 
> except for 
> > the often frustrating html checkbox issue.  That is, when 
> you submit a 
> > form with a checkbox, and the checkbox isn't checked, nothing is 
> > submitted with your form.  Therefore, makeEventBean() cannot set my 
> > record object correctly when a user un-checks a field as that 
> > information is not passed to it.
> ....
> 
> 
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- -- --
> -- -- Reactor for ColdFusion Mailing List 
> [email protected] Archives
> at: http://www.mail-archive.com/reactor%40doughughes.net/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- -- --
> -- --
> 
> 
> 
> 
> 
> 
> 
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- -- -- -- --
> Reactor for ColdFusion Mailing List
> [email protected]
> Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- -- -- -- --
> 
> 
> 
> 
> 



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to