Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts

    argg!....select box issue - read variable and then 'select' it from dropdown!!

    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>
    Last edited by BrightNail; 07-25-2002 at 09:37 PM.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try the fully qualified form:

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

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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;
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •