cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <u....@cbim.it>
Subject Re: [forms] Populate selection list from flow
Date Wed, 17 Mar 2004 13:20:51 GMT
Mark Lundquist wrote:
> 1) I don't see a way to specify the initial selected value — i.e., 
> generate the "selected" attribute in the HTML <option> element.  I 
> looked in the source code for FlowJXPathSelectionList just to see if I 
> was missing something... I think it would need to generate an <fi:value> 
> element as a child of the <fi:field>, is that correct?  It does indeed 
> appear not to do this anywhere.  Is that a deficiency of 
> FlowJXPathSelectionList?  Do any workarounds come to mind?  The two I 
> can think of are (a) set dynamic="true" and set up a pipeline to build 
> the <fd:selection-list>, and populate it from the SAX stream; or, (b) 
> revert to some client-side hack (using a hidden field, etc.)

Just set the value of the field in the form model, either via binding or 
manually. I.e.:

form.getWidget().getWidget("field-id").value = "key2";
form.showForm("uri", { "list" : [
   { value: "key1", label: "One" }, { value: "key2", label: "Two" }
]);
...
<fd:selection-list type="jxpath" list-path="list" value-path="value" 
label-path="label"/>
...

This must work, as I do it all the time.

	Ugo


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


Mime
View raw message