int4 (postgres) and integer.
Paul Joseph wrote:
Yes! this helps a lot!
What is the field datatype in the database table and also what is the field base data type of the multi-value widget?
thanks Paul --- Jorg Heymans <[EMAIL PROTECTED]> wrote:
okay, i have another case that is similar.
selectedGroups is a collections of Group objects, each group has an "id"
and "name". Upon loading i grab them from the db, upon saving i
reconstruct a collection with only the id's (formValue[i]) of the groups.
BINDING <fb:javascript id="targetgroups" path="selectedGroups" direction="load"> <fb:load-form> var collection = jxpathPointer.getNode(); widget.setSelectionList(collection, "id", "name"); </fb:load-form> </fb:javascript>
<fb:javascript id="targetgroups" path="." direction="save"> <fb:save-form> var formValue = widget.getValue(); var collection = new java.util.ArrayList(); for(var i=0; i<formValue.length; i++) { collection.add(new java.lang.Integer(formValue[i])); } var bean = jxpathPointer.getNode(); bean.setSelectedGroups(collection); </fb:save-form> </fb:javascript>
Hope this helps :-)
Regards Jorg
Paul Joseph wrote:
Thank you Jorg, very kind of you to reply. This
is a
good start.
My case differs in that my multiselect list has a
"key-value" setup i.e I have things like
value=1 label=Worker value=2 label=Manager value=3 label=Admin
and so, when I save, I want to save the values and
not
the labels.
ie my widget base data type is "integer"
also, I am persisting it to a database, so the set method has to finally get its value into a db.
thx Paul --- Jorg Heymans <[EMAIL PROTECTED]> wrote:
I have a multi-value widget working, here is my setup
MODEL
<fd:multivaluefield id="style" > <fd:label>Style</fd:label> <fd:datatype base="string"/> <fd:selection-list> <fd:item value="bold"/> <fd:item value="italic"/> </fd:selection-list> </fd:multivaluefield>
BINDING <fb:value id="style" path="style"/>
BEAN private Object[] style; public Object[] getStyle() { return style; } public void setStyle(Object[] style) { this.style = style; }
Does this help you ?
Regards Jorg
---------------------------------------------------------------------
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]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
