Javascript: Difference between revisions
Appearance
New page: {{howto|Medium|Sam Kapilivsky}} This howto demonstrates some Javascript features that are built into ATK. == Hiding and attribute or relation depending on the value of another attrib... |
No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{howto|Medium|[[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 | == 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: | If you have an attribute that should hide or show depending on the value of another attribute, you can use the following construct: | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
$attr = &$this->add(new | &$this->add(new atkAttribute('myAttribute',........ | ||
$attr->addOnChangeHandler("if (newvalue=='no') { hideAttrib(' | $attr = &$this->add(new atkBoolAttribute(........ | ||
$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'); }");