Hello,
I have done something like this before.
First you need to add a function to the field.
For example in ContactsCommon_0.php you can add: public static function"QFfield_type(&$form, $field, $label, $mode, $default, $desc, $rb_obj = null){}"
Then you can add a callback in the recordbrowser by editing your field and fill in the "Field generator function" with: "CRM_ContactsCommon::QFfield_type"
And use some javascript for your function for example:
public static function QFfield_type(&$form, $field, $label, $mode, $default, $desc, $rb_obj = null) {
$options= Utils_CommonDataCommon::get_array('_contacts/type'); // use your path to the array in CommonData
if (!is_array($options))
$options= array();
if ($mode=='add' || $mode=='edit') {
$form->addElement('select', $field, $label, $options, array('id' => $field, 'onchange' => "changetype()"));
//then you can add some javascript to your select field
eval_js('
changetype=function(){
selectedindex=$("type").options[$("type").selectedIndex].value;
(selectedindex=="P"?changetype_people():changetype_days());
}
changetype_people = function(){
$("cutoff_days").disabled=true;
//code when selected: people
}
changetype_days = function(){
$("cutoff_days").disabled=false;
//code when selected: days
}
'); //closing eval_js
//then add "changetype" to the "onchange" attribute of the select
} else {
//code for view
}
}
I hope this helps you,
Greetings,
Andy