Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Apr 2013
    Posts
    12

    Dropdown list not getting populated on Asha 310..

    Hi all,

    I am trying to populate a select dropdown list. This is a test code snippet i am trying to implement -
    (here, data is an object containing the teams array)

    Code:
    function loadTeams(data){
    	var team_str = '<option selected="selected">Choose your team</option>';
    	var temp = [];
    	for(var i=0;i<data.teams.length;i++){
    		temp[i] = data.teams[i];
    		team_str += '<option id='+temp[i]+'>'+temp[i]+'</option>';
    	}
    	document.getElementById('teamlist').innerHTML = team_str;
    }
    This is the HTML -

    Code:
    <form id="leagueform" action="">
    	<select id="teamlist"></select>
    </form>

    This works fine in the local preview (emulator) for the Series 40 Web Apps, but does not load anything on Asha 310, on which i am testing..

    What could be going wrong?

    Please help..

    PS - its not working even if i use jQuery..

    Thanks,
    Anujit

  2. #2
    Registered User
    Join Date
    Mar 2013
    Location
    United Kingdom
    Posts
    161

    Re: Dropdown list not getting populated on Asha 310..

    Hello, Anujit.

    I've just loaded your code into a sample project - the issue you're having is that you're not escaping your Javascript properly. You need to use..

    Code:
    var team_str = "<option selected=\'selected\'>Choose your team</option>";
    instead of...

    Code:
    var team_str = '<option selected="selected">Choose your team</option>';
    I've uploaded my sample project to demonstrate that my modifications will display your drop down properly - download it from here http://db.tt/CkXx37Xw

    Hope that helps.

  3. #3
    Registered User
    Join Date
    Apr 2013
    Posts
    12

    Re: Dropdown list not getting populated on Asha 310..

    Quote Originally Posted by grift View Post
    Hello, Anujit.

    I've just loaded your code into a sample project - the issue you're having is that you're not escaping your Javascript properly. You need to use..

    Code:
    var team_str = "<option selected=\'selected\'>Choose your team</option>";
    instead of...

    Code:
    var team_str = '<option selected="selected">Choose your team</option>';
    I've uploaded my sample project to demonstrate that my modifications will display your drop down properly - download it from here http://db.tt/CkXx37Xw

    Hope that helps.
    thanks for the help, grift, your examples works properly..

    but the main issue in my case which is causing the problem seems to be that - the object i am using to populate is from an online json file.. So i guess there are some timing issues because of which i am not able to populate the select list...

    thanks for the answer anyway...

  4. #4
    Registered User
    Join Date
    Mar 2013
    Location
    United Kingdom
    Posts
    161

    Re: Dropdown list not getting populated on Asha 310..

    Quote Originally Posted by anujit View Post
    thanks for the help, grift, your examples works properly..

    but the main issue in my case which is causing the problem seems to be that - the object i am using to populate is from an online json file.. So i guess there are some timing issues because of which i am not able to populate the select list...

    thanks for the answer anyway...
    I see - you could try adding a timer to your application perhaps?

  5. #5
    Registered User
    Join Date
    Mar 2013
    Location
    United Kingdom
    Posts
    161

    Re: Dropdown list not getting populated on Asha 310..

    Quote Originally Posted by grift View Post
    I see - you could try adding a timer to your application perhaps?
    Come to think about it, this is likely to be difficult. As Javascript code is executed on a proxy site by Nokia, it's going to be difficult to determine how long it will take for the proxy to run your code to parse the JSON data.

    I am thinking that storing application data as JSON may not be a good idea for a Nokia Web App.

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,791

    Re: Dropdown list not getting populated on Asha 310..

    Quote Originally Posted by grift View Post
    I see - you could try adding a timer to your application perhaps?
    See http://www.developer.nokia.com/Commu..._JavaScript.3F, so timers are not a good idea probably.

Similar Threads

  1. dropdown list
    By koraykayir in forum Symbian User Interface
    Replies: 3
    Last Post: 2010-11-02, 16:56
  2. Can I get dropdown list ID or name?
    By bartx in forum Symbian
    Replies: 1
    Last Post: 2009-12-09, 19:03
  3. Canvas based DropDown list
    By knights123 in forum Mobile Java General
    Replies: 4
    Last Post: 2009-07-27, 15:50
  4. how to implenment dropdown list ?
    By tlr in forum Symbian User Interface
    Replies: 9
    Last Post: 2009-04-15, 08:09
  5. Dropdown List or wheels ?
    By PopAndDestroy in forum Symbian User Interface
    Replies: 1
    Last Post: 2009-02-08, 18:31

Posting Permissions

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