Setting and gadget main.html

Hi guys,

I have a main.html which have a dropdownlist.

My settnig page have a text box for me to enter the text of each element in the drop down list.

after i clicked "ok" and store those values in System.Gadget.Settings, i want the values to be shown in the dropdownlist

how do i do a refresh or populate the main.html

is there any way i can get the document object of the gadget from the setting page

Please help thanks!!!!



Answer this question

Setting and gadget main.html

  • Callavin

    In your main.html, capture the Settings closing event and then add the options to your drop down.

    System.Gadget.onSettingsClosed = settingsClosed;


    function settingsClosed() {
    var tmp = System.Gadget.Settings.readString("<myOptionSetting>");
    <myOptionElement>.options[0] = new Option (tmp, tmp);
    }


    Or if you have a variable number of options, assuming they're <myOptionSetting>1/2/3 etc:

    function settingsClosed() {
    var tmp;
    <myOptionElement>.options.length = 0;
    for (var j=1; System.Gadget.Settings.readString("<myOptionSetting>" + j) != ""; j++)
    {
    tmp = System.Gadget.Settings.readString("<myOptionSetting>" + j);
    <myOptionElement>.options[j] = new Option (tmp, tmp);
    }
    }

  • nigulas

    System.Gadget.document should give you the document object of the gadget.
  • Setting and gadget main.html