You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by mo...@wipro.com on 2004/05/29 12:10:27 UTC

Cocoon binding for multivaluefield (multi select combo box)


Hi ,

I am trying to read values from a multivaluefield (multi select combo
box) from a cocoon form and use cocoon form binding to extract the
values.
My intent is to create an xml file from the data that has been selected
in the form.

I have tried all variation of cocoon form binding to get the data , but
not able to do so.

I am able to successfully read the value of a single select drop down
box, by using " <value id="searchFields" path="@searchFields" />" , but
not able to get values for multi select combo box.
I  have tried the following:

1. ) I have tried using repeaters but that give a class cast exception.
at form.save method
<?xml version="1.0" encoding="utf-8"?>

<context path="/content"
xmlns="http://apache.org/cocoon/forms/1.0#binding">
  <repeater id="searchFields" parent-path="." row-path="searchFields">
   <identity>
        <value id="name" path="@id" />
      </identity>
      <on-bind>
        <value id="name" path="@id" />
      </on-bind>
      <on-insert-row>
        <insert-node>
          <entry name="" />
        </insert-node>
      </on-insert-row>
    </repeater>
</context>

========================================================================
2. ) later I tried using only   <value id="searchFields"
path="@searchFields" />, with this I am not getting any exceptions as
such but I am not able to get the values of the selected combo box.

========================================================================
3)
I also tried using aggregator, with this I am not getting any exceptions
as such but I am not able to get the values of the selected combo box.
<aggregate id="searchFields" parent-path="." row-path="searchFields">
   <value id="value" path="@value" />
   </aggregate>

========================================================================


My definition file is as below:
<multivaluefield id="searchFields">
      <datatype base="string" />
      <selection-list src="cocoon:/select-search-fields" dynamic="true"
/>
    </multivaluefield>>



Can any one please throw some pointers what I can do to get the value
from a multivaluefield or let me know where I am going wrong

Thanks in advance.
Regards,
Moin


Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.

Re: Cocoon binding for multivaluefield (multi select combo box)

Posted by Bruno Dumon <br...@outerthought.org>.
On Sat, 2004-05-29 at 12:10, moinuddin.ahmed@wipro.com wrote:
>  
> Hi ,
>  
> I am trying to read values from a multivaluefield (multi select combo
> box) from a cocoon form and use cocoon form binding to extract the
> values.
> My intent is to create an xml file from the data that has been
> selected in the form.
>  
> I have tried all variation of cocoon form binding to get the data ,
> but not able to do so.
>  
> I am able to successfully read the value of a single select drop down
> box, by using " <value id="searchFields" path="@searchFields" />" ,
> but not able to get values for multi select combo box.
> I  have tried the following: 
>  
> 1. ) I have tried using repeaters but that give a class cast
> exception. at form.save method
> <?xml version="1.0" encoding="utf-8"?>
>  
> <context path="/content"
> xmlns="http://apache.org/cocoon/forms/1.0#binding">
>   <repeater id="searchFields" parent-path="." row-path="searchFields">
>    <identity>
>         <value id="name" path="@id" />
>       </identity>
>       <on-bind>
>         <value id="name" path="@id" />
>       </on-bind>
>       <on-insert-row>
>         <insert-node>
>           <entry name="" />
>         </insert-node>
>       </on-insert-row>
>     </repeater>
> </context>
> 
> ========================================================================
> 2. ) later I tried using only   <value id="searchFields"
> path="@searchFields" />, with this I am not getting any exceptions as
> such but I am not able to get the values of the selected combo box.
>  
> ========================================================================
> 3)
> I also tried using aggregator, with this I am not getting any
> exceptions as such but I am not able to get the values of the selected
> combo box.
> <aggregate id="searchFields" parent-path="." row-path="searchFields">
>    <value id="value" path="@value" />
>    </aggregate>
>     ======================================================================== 
>  
> My definition file is as below:
> <multivaluefield id="searchFields">
>       <datatype base="string" />
>       <selection-list src="cocoon:/select-search-fields"
> dynamic="true" />
>     </multivaluefield>>
>  
>  
>  
> Can any one please throw some pointers what I can do to get the value
> from a multivaluefield or let me know where I am going wrong

I thought there was a multivaluefield binding... yes, there is: check
the javadoc of the class MultiValueJXPathBindingBuilder for more info.

BTW, if the default bindings don't suffice, it is always possible to
write some custom code (eg. using the fb:javascript binding) to do the
binding for you.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org