Javascript

From Achievo/ATK Wiki

Jump to: navigation, search

ATK Howto: Javascript

Complexity: Medium
Author: Ivo Jansch <ivo@achievo.org>, edited by Sam Kapilivsky

List of other Howto's

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'); }");
Personal tools
Navigation