You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Martin Marinschek <ma...@gmail.com> on 2004/12/17 14:37:41 UTC

New tag - jsValueChangeListener

A new tag is available - x:jsValueChangeListener, use it to execute a
javascript expression when the value of a component has changed.

You can now execute simple java-scripts without knowing the id's of
components, you just reference the component with '$destElem'
(component which will be affected by the value change listener) and
'$srcElem' (component where the value change event originated from).

usage examples as follows:

<x:jsValueChangeListener for="text2" property="value"
expressionValue="($srcElem.value=='yes')?'true':'false'" />

<x:jsValueChangeListener for="text3" property="value"
expressionValue="$srcElem.value" />

<x:jsValueChangeListener for="text4"
expressionValue="$destElem.innerHTML = $srcElem.value" />

<x:jsValueChangeListener for="text5"
expressionValue="($srcElem.value=='hide')?$destElem.style.display='none':$destElem.style.display='inline'"
/>

Check out the source from apache and look into the examples section
for a test drive...

By the way - thanks to Sylvain for his resource-filter implementation,
great work! It is real easy to handle the inclusion of resource-files
now; deployment has been simplified by a great deal!

regards,

Martin