« Return to Thread: webuijsf:dropDown Set Selected value via Javascript

Re: webuijsf:dropDown Set Selected value via Javascript

by samotage :: Rate this Message:

Reply to Author | View in Thread


samotage banged his head against a hard surface and came up with an answer that may help some other poor stuck developer...

function setVal( state)
{
        stateElement=document.getElementById(form1:stateDD_list);
        var len = stateElement.length;
                                       
        for (var idx=0;idx < len;idx++)
        {
                if (state==stateElement.options[idx].value)
                {
                        stateElement.selectedIndex=idx;
                        stateElement.options[idx].selected=true;
                        break;
                }
        }
}

Sam.



 « Return to Thread: webuijsf:dropDown Set Selected value via Javascript

LightInTheBox - Buy quality products at wholesale price!