When I bind a form without selecting any data to the bean, I don't get
any errors, but when it contains some selections I get the following
error

uncaught JavaScript exception: at material
(file:/C:/projects/zes/construction/jboss-3.2.3/server/default/tmp/deplo
y/tmp16629ZESApplication-0.1.ear-contents/Mercury.war/inventory/flow/inv
entory.js, Line 64) at
(resource://org/apache/cocoon/forms/flow/javascript/Form.js, Line 164):
org.apache.commons.jxpath.JXPathException: Exception trying to create
xpath measureCollection; Factory is not set on the JXPathContext -
cannot create path: /facility[1]

The stack trace shows that the exception is thrown in the binding
implementation  org.apache.cocoon.forms.binding.MultiValueJXPathBinding,
within doSave(Widget frmModel, JXPathContext jctx) throws
BindingException method.

Below is that block of code, is this not implemented completely  ?? or
is my configuration not correct??? (Note the sample in the distribution
only binds the data to the bean during the loading)

if (values != null) {
            // first update the values
            for (int i = 0; i < values.length; i++) {
                String path = this.rowPath + '[' + (i+1) + ']';
     >>>>>           Pointer rowPtr =
multiValueContext.createPath(path);

                Object value = values[i];
                if (value != null && convertor != null) {
                    value = convertor.convertToString(value,
convertorLocale, null);
                }

                rowPtr.setValue(value);
            }

Below is my set up 

-----------Form Model -----------
        <fd:multivaluefield id="facility" required="false">
            <fd:label>
                <i18n:text
i18n:catalogue="inventory">material.facility.label</i18n:text>
            </fd:label>
            <fd:hint>
                <i18n:text
i18n:catalogue="inventory">material.facility.hint</i18n:text>
            </fd:hint>
            <fd:help>
                <i18n:text
i18n:catalogue="inventory">material.facility.help</i18n:text>
            </fd:help>
            <fd:datatype base="string"/>
            <fd:selection-list type="flow-jxpath" list-path="facility"
value-path="id"
                label-path="concat(name,' - ',description)"/>
        </fd:multivaluefield>

--------  Binding ------------------------

<fb:multi-value  id="materialMeasure" parent-path="."
row-path="materialMeasure"/>

-- Form template  - ---------
<ft:widget id="facility">
<fi:styling list-type="double-listbox" listbox-size="5">
<fi:available-label><i18n:text
i18n:catalogue="inventory">material.facility.avialable.label</i18n:text>
</fi:available-label>
<fi:selected-label><i18n:text
i18n:catalogue="inventory">material.facility.avialable.label</i18n:text>
</fi:selected-label>
</fi:styling>
</ft:widget>
    

--  Java Bean ----------
private Collection facility = new ArrayList();

   public Collection getFacility() {
        return facility;
    }

    public void setFacility(Collection facility) {
        this.facility = facility;
    }

-----Original Message-----
From: Marc Portier [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 12, 2004 12:47 AM
To: [EMAIL PROTECTED]
Subject: Re: Help with <fb:multi-value/> binding - CFORMS



Uchenna Igwebuike wrote:

> Does anyone have an example on how to bind data from and to a bean
using 
> an ArrayList field to store multivalue data from a form
> 

not yet (that I know of)

what have you tried? and what doesn't work?

-marc=
-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
[EMAIL PROTECTED]                              [EMAIL PROTECTED]

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