You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Fe...@thomson.com on 2006/06/07 13:31:12 UTC
CForms: conditional display of widgets
How can I do to display a certain widget in a form only if a specific
condition is met?
Depending on the value of a drop-down menu in the form, another widget
should be displayed or not,
dynamically, not only when the form is first presented.
Thanks
AW: CForms: conditional display of widgets
Posted by Christofer Dutz <du...@c-ware.de>.
Hi Fernando,
use the JX-Templates. In Order to make Cforms work you have to ad the
following as child of the templates root:
<jx:import
uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
And then stop using the forms generator but to use a normal resource or ile
generator and use the Forms transformer:
<map:transform type="forms"/>
Then all you can do the following:
<jx:if
test="${(widget.getChild('curUser_departmentId').getValue() ==
widget.lookupWidget('view/contact/gst').getValue()) &&
(widget.lookupWidget('imported').getValue() == false)}">
<ft:widget id="save"/>
</jx:if>
Hope this helps.
Oh just forgot
dont forget to declre the jx-namespace
xmlns:jx=http://apache.org/cocoon/templates/jx/1.0
Regards, Chris
[ c h r i s t o f e r d u t z ]
IT-Berater
univativ GmbH & Co. KG
Robert-Bosch-Str. 7, 64293 Darmstadt
fon: 0 61 51 / 66 717 - 21
fax: 0 61 51 / 66 717 - 29
email: christofer.dutz@univativ.de
http://www.univativ.de
Darmstadt, Stuttgart, Karlsruhe, Düsseldorf
_____
Von: Fernando.Matomira@thomson.com [mailto:Fernando.Matomira@thomson.com]
Gesendet: Mittwoch, 7. Juni 2006 13:31
An: users@cocoon.apache.org
Betreff: CForms: conditional display of widgets
How can I do to display a certain widget in a form only if a specific
condition is met?
Depending on the value of a drop-down menu in the form, another widget
should be displayed or not,
dynamically, not only when the form is first presented.
Thanks
RE: CForms: conditional display of widgets
Posted by Fe...@Thomson.com.
It doesn't work in Firefox 1.5.0.1 under Solaris
It does work in 1.5.0.3/Windows
Thanks
________________________________
From: Stuart Thorne [mailto:Stuart.Thorne@dna.co.uk]
Sent: Wednesday, June 07, 2006 1:46 PM
To: users@cocoon.apache.org
Subject: RE: CForms: conditional display of widgets
Hi,
You could use client-side JavaScript?
Add an onkeypress / onclick event on your drop-down menu, which triggers
a JavaScript 'show / hide' function.
The JavaScript 'show / hide' function on changing the drop-down value
should set the CSS property for your dynamic widget to be displayed as
{display:none} / {display:block or inline}
For Accessibility:
By default the CSS display property for the dynamic widget should be set
to display:block / inline.
Then use the JavaScript document.write to write out the display on the
rendered html page as {display:none}, for the dynamic widget. That way
if the web user does not have JavaScript available / enabled, your
dynamic field will appear by default.
Hope this helps,
Stuart
________________________________
From: Fernando.Matomira@thomson.com
[mailto:Fernando.Matomira@thomson.com]
Sent: 07 June 2006 12:31
To: users@cocoon.apache.org
Subject: CForms: conditional display of widgets
How can I do to display a certain widget in a form only if a
specific condition is met?
Depending on the value of a drop-down menu in the form, another
widget should be displayed or not,
dynamically, not only when the form is first presented.
Thanks
RE: CForms: conditional display of widgets
Posted by Stuart Thorne <St...@dna.co.uk>.
Hi,
You could use client-side JavaScript?
Add an onkeypress / onclick event on your drop-down menu, which triggers
a JavaScript 'show / hide' function.
The JavaScript 'show / hide' function on changing the drop-down value
should set the CSS property for your dynamic widget to be displayed as
{display:none} / {display:block or inline}
For Accessibility:
By default the CSS display property for the dynamic widget should be set
to display:block / inline.
Then use the JavaScript document.write to write out the display on the
rendered html page as {display:none}, for the dynamic widget. That way
if the web user does not have JavaScript available / enabled, your
dynamic field will appear by default.
Hope this helps,
Stuart
________________________________
From: Fernando.Matomira@thomson.com
[mailto:Fernando.Matomira@thomson.com]
Sent: 07 June 2006 12:31
To: users@cocoon.apache.org
Subject: CForms: conditional display of widgets
How can I do to display a certain widget in a form only if a
specific condition is met?
Depending on the value of a drop-down menu in the form, another
widget should be displayed or not,
dynamically, not only when the form is first presented.
Thanks