Javascript: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{howto|Medium| [Ivo Jansch] edited by [[Sam Kapilivsky]]}} | {{howto|Medium| [[Ivo Jansch]] <ivo@achievo.org>, edited by [[Sam Kapilivsky]]}} | ||
This howto demonstrates some Javascript features that are built into ATK. | This howto demonstrates some simple Javascript features that are built into ATK. | ||
== Hiding or showing an attribute or relation depending on the value of another attribute == | == Hiding or showing an attribute or relation depending on the value of another attribute == | ||
| Line 12: | Line 12: | ||
$attr->addOnChangeHandler("if (newvalue=='no') { hideAttrib('myAttribute'); } else { showAttrib('myAttribute'); }"); | $attr->addOnChangeHandler("if (newvalue=='no') { hideAttrib('myAttribute'); } else { showAttrib('myAttribute'); }"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 22:15, 14 November 2008
|
ATK Howto: Javascript
|
This howto demonstrates some simple Javascript features that are built into ATK.
Hiding or showing an attribute or relation depending on the value of another attribute
If you have an attribute that should hide or show depending on the value of another attribute, you can use the following construct:
&$this->add(new atkAttribute('myAttribute',........
$attr = &$this->add(new atkBoolAttribute(........
$attr->addOnChangeHandler("if (newvalue=='no') { hideAttrib('myAttribute'); } else { showAttrib('myAttribute'); }");