Page 1 of 1

Drop Down question

Posted: Wed Oct 29, 2014 1:20 pm
by SeanTyree
Is there any functionality in the select box widget to support the HTML <option> disabled Attribute as demonstrated here: http://www.w3schools.com/tags/att_option_disabled.asp?

I have a need to include options in a drop down that are no longer active, but the option needs to exist for historical purposes.

Sean

Re: Drop Down question

Posted: Wed Oct 29, 2014 1:38 pm
by negley
If there isn't, you could always just Javascript to setup the options onload().

Static
getObj('Dropdown1').innerHTML = '<option value="volvo" disabled>Volvo</option<option value="saab">Saab</option><option value="vw">VW</option><option value="audi">Audi</option>';

Dynamic
Assign RPGVAR to a hidden output character field, 200A; create html options in RPG.
getObj('Dropdown1').innerHTML = get('RPGVAR');

-Bill

Re: Drop Down question

Posted: Thu Oct 30, 2014 12:26 am
by Scott Klement
Rather than replace the innerHTML of the DOM element, why not just set it to disabled?

Code: Select all

getObj("TheDropDown").options[3].disabled = true;
It's true that you'd need to use a hidden field (or similar) from RPG to indicate somehow which options to disable, but that shouldn't be too hard if the drop-down is also loaded from RPG.

Re: Drop Down question

Posted: Thu Oct 30, 2014 1:17 pm
by SeanTyree
Thanks for these suggestions, but the drop-down is loaded via SQL...

I thought there might be some hidden functionality (eg. a hidden second column for disabling options).

Sean