You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Arsen A. Gutsal" <ar...@softsky.com.ua> on 2005/04/25 10:29:03 UTC

fd:selection-list selected item

Hi List.

How to set up default item within fd:selection-list (HTML equivalent is
<option selected/>)?

-- 
Arsen A. Gutsal <ar...@softsky.com.ua>
SOFTSKY Inc


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


Re: fd:selection-list selected item

Posted by "Arsen A. Gutsal" <ar...@softsky.com.ua>.
thanks.
it works now.

On Mon, 2005-04-25 at 13:09 +0200, Reinhard Poetz wrote:
> Arsen A. Gutsal wrote:
> > Reinhard.
> > Can you please gimme some simple example of how to use controller.
> 
> see the Cocoon Forms examples, here the flowscript (= controller) of the 
> carselector:
> 
> function selectCar() {
>      var form = new Form("forms/carselector_form.xml");
>      form.lookupWidget("make").setValue(cocoon.parameters.defaultMake);
>      form.showForm("carselector-display-pipeline.jx");
>      cocoon.request.setAttribute("carselectorform", form.getWidget());
>      cocoon.sendPage("carselector-success-pipeline.xsp");
> }
> 
> What do you use as controller? Flowscript, Actions, Apples?
> 
-- 
Sincerely,
Arsen A. Gutsal
SOFTSKY Ltd CEO/Executive
SOFTSKY - Cost effective Software Development


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


Re: fd:selection-list selected item

Posted by Reinhard Poetz <re...@apache.org>.
Arsen A. Gutsal wrote:
> Reinhard.
> Can you please gimme some simple example of how to use controller.

see the Cocoon Forms examples, here the flowscript (= controller) of the 
carselector:

function selectCar() {
     var form = new Form("forms/carselector_form.xml");
     form.lookupWidget("make").setValue(cocoon.parameters.defaultMake);
     form.showForm("carselector-display-pipeline.jx");
     cocoon.request.setAttribute("carselectorform", form.getWidget());
     cocoon.sendPage("carselector-success-pipeline.xsp");
}

What do you use as controller? Flowscript, Actions, Apples?

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------


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


Re: fd:selection-list selected item

Posted by "Arsen A. Gutsal" <ar...@softsky.com.ua>.
Reinhard.
Can you please gimme some simple example of how to use controller.

On Mon, 2005-04-25 at 11:39 +0200, Reinhard Poetz wrote:
> Arsen A. Gutsal wrote:
> > It does not work for me.
> > I'm using cocoon-2.1.6, that's why I guess.
> > Anyway - I've set widget value (in the template), and it works fine, 
> > except that <select> widget does not displays selected value.
> > <jx:if test="${cocoon.request.getParameter('user-type')}">
> > ${form.lookupWidget('registration_type').setValue(cocoon.request.getParameter('user-type'))}
> > </jx:if>
> > 
> > Any suggestions?
> 
> It's NOT the concern of the presentation layer to set the values of a wdiget. 
> IMHO this is an absolute DON'T as it introduces side-effects (presentationlayer 
> changes the data model). Try to set the widget value using the controller. I 
> guess this will solve your problem.
> 
> Also make sure that the set value is equal to the key of the item of the 
> selection list.
> 
-- 
Sincerely,
Arsen A. Gutsal
SOFTSKY Ltd CEO/Executive
SOFTSKY - Cost effective Software Development


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


Re: fd:selection-list selected item

Posted by Reinhard Poetz <re...@apache.org>.
Arsen A. Gutsal wrote:
> It does not work for me.
> I'm using cocoon-2.1.6, that's why I guess.
> Anyway - I've set widget value (in the template), and it works fine, 
> except that <select> widget does not displays selected value.
> <jx:if test="${cocoon.request.getParameter('user-type')}">
> ${form.lookupWidget('registration_type').setValue(cocoon.request.getParameter('user-type'))}
> </jx:if>
> 
> Any suggestions?

It's NOT the concern of the presentation layer to set the values of a wdiget. 
IMHO this is an absolute DON'T as it introduces side-effects (presentationlayer 
changes the data model). Try to set the widget value using the controller. I 
guess this will solve your problem.

Also make sure that the set value is equal to the key of the item of the 
selection list.

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------


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


Re: fd:selection-list selected item

Posted by "Arsen A. Gutsal" <ar...@softsky.com.ua>.
It does not work for me.
I'm using cocoon-2.1.6, that's why I guess.
Anyway - I've set widget value (in the template), and it works fine,
except that <select> widget does not displays selected value.
							<jx:if test="${cocoon.request.getParameter('user-type')}">
								${form.lookupWidget('registration_type').setValue
(cocoon.request.getParameter('user-type'))}
								</jx:if>

Any suggestions?

On Mon, 2005-04-25 at 10:47 +0200, Reinhard Poetz wrote:

> Arsen A. Gutsal wrote:
> > Hi List.
> > 
> > How to set up default item within fd:selection-list (HTML equivalent is
> > <option selected/>)?
> 
> You have to set the value of the widget. AFAIK there is a new, undocumented fd: 
> element: <fd:initial-value>...</>. Of course you can access the widget in the 
> controller and set the value there using the cForms API.
> 
> Of course you have to make sure that the value you set is part of the selection 
> list.
> 

-- 
Sincerely,
Arsen A. Gutsal
SOFTSKY Ltd CEO/Executive
SOFTSKY - Cost effective Software Development

Re: fd:selection-list selected item

Posted by Reinhard Poetz <re...@apache.org>.
Arsen A. Gutsal wrote:
> Hi List.
> 
> How to set up default item within fd:selection-list (HTML equivalent is
> <option selected/>)?

You have to set the value of the widget. AFAIK there is a new, undocumented fd: 
element: <fd:initial-value>...</>. Of course you can access the widget in the 
controller and set the value there using the cForms API.

Of course you have to make sure that the value you set is part of the selection 
list.

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------


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