I have a field that i want to be disabled on loading the module in sugar 5.2.0h. to test i add this to the opportunities module:
and in disable.jsPHP Code:1 =>
array (
'label' => '10',
'field' => '30',
),
),
//this part here
'includes'=> array(
array('file'=>'custom/modules/Opportunities/disable.js'),
),
...
but when I try to create a new record the amount field is still enabledCode:function disable_field() { getElementsByName('amount')[0].disabled=true; } if (window.addEventListener) window.addEventListener("load", disable_field, false); else if (window.attachEvent) window.attachEvent("onload", disable_field) else window.onload=disable_field
i also tried putting in index.php, editviewdefs.php and Opportunityvardefs.php
on a side note adding a button with the above code and change to onclick works when you click the buttonPHP Code:echo '<input type="hidden" onLoad="getElementsByName(\'amount\')[0].disabled=true">';
a simple question is why doesn't this workPHP Code:echo '<button onClick="getElementsByName(\'amount\')[0].disabled=true">Click</button>';
but i change to onclick it works when i click it, so why doesn't the onload function work in 5.2.0hPHP Code:array (
'name' => 'sales_stage',
'displayParams' =>
array (
'required' => true,
'javascript' => 'onload="getElementsByName(\'sales_stage\')[0].disabled=true"',
),
'label' => 'LBL_SALES_STAGE',
),
can anyone tell me why this isn't working


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks