Hi, I’ve been experimenting with adding some realtime logic using javascript but have run into an error when trying to get anything to work after my editview originally loads.
editviewdefs.php
‘templateMeta’ => array(
‘includes’ => array(
array(
‘file’ => ‘custom/modules/Moves_Moves/js/hideField.js’,
),
),
‘javascript’ => ‘’,
)
…
1 =>
array (
‘name’ => ‘canceled_c’,
‘label’ => ‘LBL_CANCELED’,
‘displayParams’ =>
array(
‘javascript’ => ‘onchange=HideField();’,
),
)
hideField.js
function HideField(){
if (document.getElementById(‘canceled_c’).checked){
alert(‘canceled’);
}
}
I’m using a dummy messagebox just to make sure that onchange is working. If I check my checkbox and save it then when I enter editview on the record I do get the alert, maybe it’s because I called the javascript under the include definition so it is running initially. But, I’ve been playing with this for a little bit and cant get ‘onchange’ to register to my script. Anyone work with javascript in suitecrm often? Most of my experience is in PHP