Settings, user input & Validation RRS feed

  • Question

  • On to a new topic... here is my next challenge:


    in my gadget's settings I have two text boxes for user input.. these will be username and password



    <div class="section">
                <label id="user">Username:</label><br />
                    <input id="username"type="text" class="inputText" size="15" maxlength="50" />
            <div class="section">
                <label id="pass">Password:</label><br />
                    <input id="password" type="text" class="inputText" size="15" maxlength="50" />



    how do I get the gadget to save what the user has typed in to  variables Username and Password, respectively?


    Any ideas/suggestions as to how I should go about connecting to my database and validating their input?



    Friday, December 28, 2007 7:57 PM

All replies

  • Hi,


    save settings script

    function settingsclosing(event) {
      if (event.closeAction == event.Action.commit) {
        //save changings ...
        System.Gadget.Settings.write("user", username.value);
        System.Gadget.Settings.write("pwd", password.value);
      } else  {
        //User canceled settings dialog ... nothing to do



    Now you can read out setting whenever you want using the following

    Code Snippet

    variable1 = System.Gadget.Settings.read("user"); //username

    variable2 = System.Gadget.Settings.read("pwd");  //password




    Saturday, January 26, 2008 5:14 PM