...

View Full Version : argg!....select box issue - read variable and then 'select' it from dropdown!!



BrightNail
07-25-2002, 09:15 PM
hey all,

why isn't this working...for some reason, I figure this would be cake..but its giving me issues..

okay...passing a variable thru a function call -->

I need to "use" this variable as the "value" for a select box...the value EXISTS in the select box options...I need the select box to change to that 'variable value"...HOW damn....

function whatever (someVal){
document.cellular.adapter.options[document.cellular.adapter.selectedIndex].value=someVal;
}

why doesn't this work..I've tried sooo many combos..but nothing....I get "cellular is not defined" ..but it is..its the name of the form....and "adapter" is the name of the select box

just so you know..the select elements are generic and dno't possess a value within the option tag....so, is there a way to navigate them WIHTOUT this..

<select name=adapter>
<option>hello</option>
<option>byebye</option>
</select>

Roy Sinclair
07-25-2002, 09:59 PM
Try the fully qualified form:



function whatever (someVal){
document.forms.cellular.adapter.options[document.forms.cellular.adapter.selectedIndex].value=someVal;
}

BrightNail
07-25-2002, 10:29 PM
this is what I have..in essence....I can move around via the select box...if I use "text"..but if I use "value" it wno't work...what gives..

function inputValues(boxName, boxValue){
alert(multipleformat)
var result=boxName.split(".");
var resultDate= boxValue.split("/");
if(multipleformat != true){
document[result[0]][result[1]].value=boxValue;
}else{
alert(resultDate[0]);
document[result[0]][result[1]].options[document[result[0]][result[1]].selectedIndex].value=nummonth(resultDate[0]);
}
}
function nummonth(numMon){
var zro=/^0/;
num=numMon.replace(zro,"");
return num;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum