cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastien Arbogast <sebastien.arbog...@gmail.com>
Subject Re: [CForms] Getting selectedValues from a multivaluefield ?
Date Sun, 22 May 2005 20:23:50 GMT
I should... and I did but it doesn't work as expected.
Here is my flowscript method :

function createUser(){
    getSchaman();
    var form = new Form("forms/create_user_d.xml");
    var user;
    var model;
    
    var roles = schaman.getAllRoles();
    form.lookupWidget("userRoles").setSelectionList(roles,"name","name");    
    
    form.showForm("internal/display-user-creation-form");
    model = form.getModel();
    user = schaman.createUser(
        model.userName,
        DigestUtils.md5Hex(model.password),
        model.userActive,
        model.userEmail,
        model.userRoles
    );
    
    cocoon.sendPage("users-list");
}

And the corresponding form definition :

<fd:form id="data"
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
    <fd:widgets>
        <fd:booleanfield id="userActive">
            <fd:label>
                <i18n:text key="user-active"/>
            </fd:label>
        </fd:booleanfield>
        <fd:field id="userName" required="true">
            <fd:label>
                <i18n:text key="user-name"/>
            </fd:label>
            <fd:datatype base="string"/>
        </fd:field>
        <fd:field id="userEmail" required="true">
            <fd:datatype base="string">
                <fd:validation>
                    <fd:email/>
                </fd:validation>
            </fd:datatype>
            <fd:label>
                <i18n:text key="user-email"/>
            </fd:label>
        </fd:field>
        <fd:field id="userPassword" required="true">
            <fd:label>
                <i18n:text key="user-password"/>
            </fd:label>
            <fd:datatype base="string"/>
            <fd:validation>
                <fd:length min="5" max="20"/>
            </fd:validation>
        </fd:field>
        <fd:field id="confirmPassword" required="true">
            <fd:label>
                <i18n:text key="confirm-password"/>
            </fd:label>
            <fd:datatype base="string"/>
            <fd:validation>
                <fd:assert test="userPassword = confirmPassword">
                    <fd:failmessage>
                        <i18n:message key="different-passwords"/>
                    </fd:failmessage>
                </fd:assert>
            </fd:validation>
        </fd:field>
        <fd:multivaluefield id="userRoles">
            <fd:label><i18n:text key="user-roles"/></fd:label>
            <fd:datatype base="string"/>
            <fd:selection-list/>
        </fd:multivaluefield>
    </fd:widgets>
</fd:form>

But when I do this I get the following exception :

Cannot convert org.apache.cocoon.forms.flow.javascript.ScriptableWidget@1da77f5
to java.lang.String[]

Any idea ?

-- 
Sebastien ARBOGAST

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


Mime
View raw message