×

Discussion Board

Results 1 to 14 of 14

Hybrid View

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    29

    Hoe to get select box value?

    Hi

    I have created one sample code of the Select box , i did get the selected value from select box.
    my code sample is working in WRT but not in Web apps.

    var airport = new Array('New Delhi','Chennai','Bangalore', 'Goa', 'Hyderabad', 'Kolkata', 'Mumbai', 'Pune', 'Agra', 'Agatti Island');
    var from="";
    var from_value="";

    javascript file is

    function init()
    {
    var val_option="";
    for(var i=0; i<airport.length;i++)
    {
    val_option=val_option+"<option value="+airport[i]+" id="+i+">"+airport[i]+"</option>";

    }
    var cre_selectbox="<table><tr><td>Destination</td><td><select id='id_value'>"+val_option+"</select></td></tr><tr><td colspan='2'><input type=submit value='submit' name='submit' onclick='javascript:getvalue()'></td></tr></table>";
    mwl.insertHTML("#selectboxid", cre_selectbox);
    }
    function getvalue()
    {
    from = document.frm.id_value.selectedIndex;
    from_value = document.frm.id_value.options[from].value;
    var selectedvalue="<table border=1><tr><td>"+from+"</td></tr></table>";
    mwl.insertHTML("#value", selectedvalue);
    init();
    }

    html file
    <body onload="init();">
    <form name='frm'>
    <div id="selectboxid"></div>
    <div id="divvalue"></div>
    </form>

    </body>

  2. #2
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: Hoe to get select box value?

    Hi,

    Try this one out:

    index.html
    Code:
    <select id="destination">
    </select>
    <div onclick="getSelected();">Select</div>
    		
    <div id="out"></div>
    Javascript:
    Code:
    var airport = new Array('New Delhi', 'Chennai', 'Bangalore', 'Goa',	'Hyderabad', 'Kolkata', 'Mumbai', 'Pune', 'Agra', 'Agatti Island');
    
    function init() {	
    	var val_option = "";
    	for ( var i = 0; i < airport.length; i++) {
    		val_option = val_option + "<option value=\"" + airport[i] + "\" id=" + i+ ">" + airport[i] + "</option>";
    	}
    	document.getElementById("destination").innerHTML = val_option;
    }	
    
    function getSelected(){
    	var dstSelection = document.getElementById("destination");
    	var destination = dstSelection.options[dstSelection.selectedIndex].value;
    	
    	document.getElementById("out").innerHTML = destination;
    }
    Br,
    Ilkka

  3. #3
    Registered User
    Join Date
    Aug 2011
    Posts
    29

    Re: Hoe to get select box value?

    thanks your reply, this code is working fine in web apps Simulator ,But not in Nokia Device (x3-02). How can solve this problem, what should i do?

    thanks,
    greenbil

  4. #4
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: Hoe to get select box value?

    Hi,

    I tested that in the device x3-02 Browser 1.0.2.26.6. Could you describe how it fails on your device and what browser version do you have installed?

    Br,
    Ilkka

  5. #5
    Registered User
    Join Date
    Aug 2011
    Posts
    29

    Re: Hoe to get select box value?

    Hi,

    I tested in device (x3-02) Browser version 1.0.3.23.12. I got first 2 values of array index('New Delhi', 'Chennai'),but i did not get remain values of the array when i select the Combo box.

    thanks,
    greenbil

  6. #6
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: Hoe to get select box value?

    Hi greenbil,

    You are right. It is broken in 1.0.3.23.12. 1.0.3 is a beta client and points to a different environment than 1.0.2.26.6. I would suggest you to migrate to 1.0.2.26.6 as it is using 'production' environment. In addition 1.0.2.26.6 is the client that masses are using - delivery channel is Ovi store.

    -Ilkka

Similar Threads

  1. Replies: 2
    Last Post: 2011-08-11, 08:29
  2. Which mtm should I select?
    By wiso33 in forum Symbian
    Replies: 3
    Last Post: 2009-06-24, 11:11
  3. select.select() with server sockets
    By y.a.k in forum Symbian
    Replies: 2
    Last Post: 2007-12-10, 14:20
  4. Commands on the SELECT key
    By vacca.m in forum Mobile Java General
    Replies: 1
    Last Post: 2003-04-08, 08:09
  5. Can't select AP
    By list101 in forum Multimodecards
    Replies: 1
    Last Post: 2002-12-04, 12:21

Posting Permissions

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