Forum Moderators: open
Here's what I have so far:
document.editCompany.companyCategory.options["14"].selected = true;
What I'm looking for is something like this:
document.editCompany.companyCategory.options.value["blue widgets"].selected = true;
<form name="frmMyFormName"
method="post"
action="http://www.WHATEVER_WHATEVER_WHATEVER">
and then use
document.frmMyFormName.mySelectName.selectedIndex=0;
document.frmMyFormName.mySelectName.selectedIndex=14;
selectedIndex=14' sets the 15th option)
Here's what I was able to find:
function Select_Value_Set(SelectName, Value)
{
eval('SelectObject = document.' + SelectName + ';');
for(index = 0; index < SelectObject.length; index++)
{
if(SelectObject[index].value == Value)
SelectObject.selectedIndex = index;
}
}
then just use:
Select_Value_Set("editCompany.companyCategory", "14");
to set the index. I wish I could credit the author but I've been through so many samples of code today I can't remember where this one came from.