Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User ghimyap's Avatar
    Join Date
    Jan 2010
    Posts
    10
    Dear everyone out there,

    Does anyone know how to load the saved radio buttion using widget.preferemceForKey()

    var saveRadio = widget.preferenceForKey("radio");
    ??????

    Another Parts of the code below:

    Radio.html
    <p><input type="radio" id="r01" name="1" value="On"/>
    <label> On</label>
    <input type="radio" id="r02" name="1" value="Off" checked="true"/>
    <label> Off</label></p>
    <input type="button" name="save" value="Save" onclick="save();">

    Radio.js
    function save() {

    if(document.myForm.r01.checked=="true"){
    widget.setPreferenceForKey(document.getElementById("r01").checked, "radio");
    }
    else {
    widget.setPreferenceForKey(document.getElementById("r02").checked, "radio");

    }

    alert("Your setting is saved.");
    }

    It would be best if theres example
    on saving and loading radio buttons
    Thanks in advance
    Will deeply appreaciate your help.

  2. #2
    Nokia Developer Moderator isalento's Avatar
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    831
    Hello,

    How about just saving the radio button id?

    Code:
    function save() { 
    
    	if(document.getElementById("r01").checked){		
    		widget.setPreferenceForKey("r01", "radio"); 
    	}
    	else{
    		widget.setPreferenceForKey("r02", "radio");	
    	}
    
    	alert("Your setting is saved.");
    
    }
    
    function load(){
    	
    	if (widget.preferenceForKey("radio")){
    		var radioId = widget.preferenceForKey("radio");		
    		document.getElementById(radioId).checked = true;		
    	}
    }
    -Ilkka

  3. #3
    Registered User ghimyap's Avatar
    Join Date
    Jan 2010
    Posts
    10
    HEY

    Thanks. It worked exactly the way I wanted. Thanks a lot!!!


    ghimyap

Similar Threads

  1. save page --> load page
    By torio in forum Mobile Web Site Development
    Replies: 1
    Last Post: 2008-10-14, 16:29
  2. generate, save and load MIDI file
    By hp3 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2006-09-20, 23:17
  3. how to load and save CAknSettingItemList's settings?
    By yinjialiang in forum Symbian C++
    Replies: 8
    Last Post: 2003-11-21, 15:51

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved