Set listbox value using javascript on web

The form I have contains a radio button, a listbox and an embedded view.

The embedded view sets it’s single category according to the value of the listbox, which alters it’s values depending on the value of the radio button.

This works fine, except that when I change the value of the radio button I try and set the value of the listbox at the same time but the value doesn’t actually exist on the document itself, so the embedded view shows ‘No Documents Found’. The listbox looks right, but must just display the first value in it’s list.

I’m trying to change the values on the OnChange of the radio button, which is also where I do a manual refresh.

The code I’m using is:

//get the value of RSSMainOptions, and change the value of the RSSOptions depending on it

radioField = document.forms[0].RSSMainOptions;

rLen = radioField.length;

for (i=0;i<rLen;i++) {

if (radioField[i].checked) {

radioVal = radioField[i].value;

}

}

if (radioVal ==“X”) {

alert (‘value is X’);

document.forms[0].RSSOptions.selectedIndex = 0;

}

_doClick(‘$Refresh’,this,null);

radioVal is set to X, and the alert prompts (i’ve taken it out as well, just in case it was something to do with that), but the value of the listbox is simply not set (checked on the page source).

Am I doing something fundamentally wrong, I’m fairly new to web design?

Cheers

Dan

Subject: Set listbox value using javascript on web

“Am I doing something fundamentally wrong”'Fraid so

Once you’ve set the value in the listbox, you’ll have to refresh the form to load the correct view/category

…

but that wipes out the contents of the list box!

I have had success with putting an iframe on the webpage, and then setting the .src URL of the iframe to be the view & single category you want, triggered by an onchange event in the listbox

Chris

Subject: RE: Set listbox value using javascript on web

Thanks Chris, that makes sense is just a bit frustrating - being new to web design I’m still getting my head around what can and can’t be done.

Will give what you’re suggesting a go

Dan