Changes

Remove Options from a Combo Box Using JavaScript

442 bytes added, 18:29, 27 November 2009
no edit summary
==Remove One or More Options==
''Example 1,''
The following example removes two different [[Types]] available for new '''Level 2''' records (useful if you need to define complex criteria for what type of Level 2 records can be created):
</pre>
''Example 2,''
The following example removes a Branch on '''Level1''' from the Branch drop down list.
 
<pre>
function RemoveBranches()
{
var i=0;
var frm=document.form1;
// Note: this loop starts at the bottom to avoid skipping any due to re-indexing as they are removed.
for(i=3;i>=0;i--)
{
if (frm.branchid.options[i].value=='448060')
//448060 is a Branch id
frm.branchid.remove(i);
}
}
RemoveBranches();
 
</pre>
If you wish to control this by [[Role|role]] (for example if you want a role to be able to view existing Level 2 records of a given [[Type]], but not create them...)
Smartstaff
137
edits