[Opensource] multi-valued fields towards multiple selectboxes

Lirian Ostrovica lirian.ostrovica at senecac.on.ca
Fri Mar 21 06:27:37 PST 2003


Hi Dave and Mike,
Thanks for the quick answers.
Back to the same issue, my concern is in fact on the persistence layer (I have
already resolved on my own way the presentation and the form data collection,
much like you guys did)

My question is :
How do I store  into database the field values  coming from a multiple select
MenuBox.
What kind of DBObject field would be able to do that ?

In other words :
A DBObject record (or instance) can be presented in a HTML FORM, but the way
around is not always possible.
If the html form contains a multiple select box or a group of checkboxes, I can
not represent it as a DBObject field.

In my practical case, I have some Registration Info for my users that consist of
multiple selection, and I can not use the
Expresso Registration Object for them.

My first thoughts have been about either playing with a regular DBObject field,
whose value will be a delimiter separated string of the selected values, or
playing with the multi-valued DBObject fields.

looking forward to any idea or opinion

Lirian



Michael Rimov wrote:

> At 10:52 AM 3/20/2003 -0500, you wrote:
> >Expreso provides for automatically generating a HTML FORM FIELD, that would
> >correspond to a DBObject FIELD, and be used to update the field value.
> >A typical example is the generation of HTML forms for Registration Objects.
> >
> >I need that one field of my registration information be a multiple choice
> >MenuBox.
> >In DBObject terms this would mean that I need a multi-valued field, whose
> >value
> >be A SET of some of those valid values.
> >DBObject multi-valued fields go fine with html MenuBoxes that allow only a
> >single choice (multiple=false), but how about the multiple choices ?
> >So my question is :
> >1 - Does Expresso have any support for this kind of field. (I looked a bit
> >through the source code and could not find any clue).
> >2 - If not, has anyone used any work around to this.
>
> Lirian,
>
> Multiple selects in menu boxes are, indeed, not directly
> supported.  Multiple checkboxes can be supported by giving each checkbox a
> unique ID number... I've done it that way in a couple of projects, and
> although the jsp is a little weird it makes the code on the expresso side
> much easier.
>
> To deal with multiple selections of the same name, you'll need to downcast
> ControllerRequest to ServletControllerRequest so you can get a List of all
> parameters, not just a Map of them.
>
> HTH!
>                                                  -Mike
>
> _______________________________________________
> Opensource mailing list
> Opensource at jcorporate.com
> http://mail.jcorporate.com/mailman/listinfo/opensource
> Archives: http://mail.jcorporate.com/pipermail/opensource/




More information about the Opensource mailing list