Hi Uchenna! Thank you for your input.

I realized this issue is probably solved in the 2.1.4 version, where a value
set to ="" is treated as a relation set to null. I haven't tried it yet
though.

>From http://cocoon.apache.org/2.1/changes.html:

"Cocoon Forms (Woody) selection lists now allow empty value (which is
translated to the null object) (VG)"

Furthermore I want to get as far away as possible from my beans so I use
dynamic XML sources to populate the selection-lists. I believe it is a good
idea to be true to XML rather than be dependent on the backend (J2EE)
implementation. However I'm not sure whether the solution stated above is
expanded to changes in the Model or the actual xml list source. I believe a
model attribute for this would be a good tool.

Idea:

<wd:selection-list src="cocoon:/my-itemset" dynamic="true" nullable="true">
  selection-label for null value here, also some styling sorting stuff for
the null-option would be good (first/last/with the rest of the items)
</wd:selection-list>

I'm sure you want your cocoon:/my-itemset purified, e.g. without the extra
<item/> at other places in your web application.


Cheers,

   Ulf Sahlin


> -----Ursprungligt meddelande-----
> Fran: Uchenna Igwebuike [mailto:[EMAIL PROTECTED]
> Skickat: den 17 mars 2004 15:43
> Till: [EMAIL PROTECTED]
> Amne: RE: Can a Woody selection-list relationship be not set?
>
>
> I use the FlowJXPathSelectionList to populate my selection lists from
> bean collections. You can use an extension of that model to insert a
> prompt message into the selection lists. The prompt message should be
> located in a message bundle that you refer to in the form definition.
> You also have to insert an entry in the cocoon.xconf.
>
>
> Steps
> 1.    Compile the two classes attached and drop them into your cocoon
> cp
> 2.    Insert the following entry into your cocoon.xconf - in the
> <woody-selection-lists> element
>
>         <selection-list
> class="org.apache.cocoon.woody.datatype.FlowJXPathSelectionListWPromptBu
> ilder" name="flow-jxpath-wprompt"/>
>
> 3.  Refer to the list in your form eg
>            <wd:selection-list type="flow-jxpath-wprompt"
> list-path="stockMeasure" value-path="id"
>                 label-path="concat(name,' - ',description)"
> msg-key="selection.prompt"/>
>
> 4. Insert the msg-key in your default resource bundle for that sitemap
> ie.
>   <message key="selection.prompt">Please Select</message>
>
>
>
> -----Original Message-----
> From: Ulf Sahlin [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 16, 2004 6:13 PM
> To: Cocoon Users
> Subject: Can a Woody selection-list relationship be not set?
>
> Hello!
>
> Maybe this is a silly question but I couldn't find an answer in the
> mail-list archives nor the Wiki.
>
> I want to be able to have a [0..1] cardinality on the one-side of a
> relationship (e.g. the relationship could either be set or not be set).
>
> If I use a selection-list in the Woody model I get a nice <select>-style
> output, however the relationship NEEDS to be set this way. Is there some
> standard way I could allow the relationship to NOT be set? If I put an
> empty
> <wd:item/> at the beginning of the selection-list I have the option of
> selecting that empty option, somehow meaning the relationship isn't set.
> However this does not translate very well when the form is to be saved
> to
> the object. The error I get is some BindingException - which is well
> what I
> expected.
>
> I would very much like to solve this somwhere in the model rather than
> in
> the selection-list item list, since imho it's a near-model issue. Any
> ideas?
>
>
> Cheers,
>   Ulf Sahlin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to