Bob,
Your issue involving a check box is curious to me.

If you submit a form in MG:U, you are calling a given event.  This event
translates all form and URL objects into a stateful bean.  Now, if the check
box is not submitted, then yes you would not have the variable defined.

Would it not be pertinent in your controller to detect for the absence of
this variable?  The controller is really meant to handle such business rule
requirements to enable the flow of your application to communicate with the
model and view effectively.  If you are using a bean from Reactor, you could
just use a setter to add a default value of the value object unless you want
to modify the value object itself to hold a default value.

The consideration here is the ease of deploying the code base.  Would want
to put on your deployment plan to ensure a custom object or would you rather
just have the logic built in your controller?  Either way accomplishes the
same end, but you need to think of your own sanity and the sanity of the
developer behind you.

OO doesn't have to mean crazy abstractions as even OO business objects need
initializations of variables for object mutation.

On 3/28/07, Bob Silverberg <[EMAIL PROTECTED]> wrote:

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/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --




--
Teddy R. Payne
Adobe Certified ColdFusion MX 7 Developer
Google Talk - [EMAIL PROTECTED]

Atlanta ColdFusion User Group - http://www.acfug.org
Atlanta Flash & Flex User Group - http://www.affug.org


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

Reply via email to