Changes

Remove Options from a Combo Box Using JavaScript

484 bytes added, 16:53, 29 October 2009
no edit summary
::''Note that you must test for greater than or equal to 0. If the role is the first on listed in the users role list it will return a 0 rather than a 1 because of the preceding comma.''
 
 
==To Remove All Options Except the Selected==
* The following script will prevent users from changing the Level 2 Type once the record has been saved:
<pre>
// For existing Types remove all options from the Type field (except the selected) so it can't be changed
if (frm.eventid.value!=0)
{
for (i=frm.eventtype.options.length-1;i>=0;i--)
{
if (frm.eventtype.options[i].value!=frm.eventtype.value)
frm.eventtype.options[i]=null;
}
}
</pre>
 
0
edits