cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Chávez <ccha...@agssa.net>
Subject Re: Cforms on-load like <fd:on-value-changed>
Date Mon, 17 Jan 2005 15:37:12 GMT

Christoph Hermann Escribio :-)
> Mark Lundquist schrieb:
>
> Hello,
>
>> > is there something like an on-load for a widget?
>> > I want to set the value of a select-list depending on the value of
>> > another widget when the form is loaded. (I need something to set
>> > the selected value when the Form is loaded.)
>>
>> What do you mean by "when the Form is loaded"?
>
> I meant when (before) its displayed the first time.
> Maybe there is a better solution to my Problem...
> I have two widgets (id, select). I get the id out of a database and
> populate the select list also with all possible values from the
> database using flow-jxpath implementation.
>
> When the select is changed i use the on-value changed to get the id for
> the selected value from the database and set the value of the
> id-widget.
>
> I now want to have the value from the database to be selected in the
> select-widget.
>
> Is there any better way to do this?
>
> Christoph
>

 Hi Christoph,

 you can try this in the binding, using fb:javacript, for example

 <fb:value id="id" path="id"/>
 <fb:value id="fieldToHaveList" path="fieldToHaveList"/>

 <fb:javascript id="fieldToHaveList" path="fieldOfTheBean" direction="load">
  <fb:load-form>
    // the "widget" var is the field reference in id="fieldToHaveList"

    // Obtain the value of the widget what you need for populate the
    // List
    var id = widget.parent.getChild("id").getValue();

    // then you can do what do you need for populate the list
    // sentences write to continue
    typewidget.setSelectionList(  what you need   );
  </fb:load-form>
 </fb:javascript>

 this work is you write in the flowscript form.load(bean)

 Cheers.

-- 
Carlos Chávez

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


Mime
View raw message