title: Google App Script WebApp, Manipulating UI
body: <p>Hi and Good day to all, </p>
  
  <p>Google App Script can be used in so many  ways. I know cause I have tried some of them but Iam not an expert so, the situation is.</p>
  
  <p>I have created an Spreadsheet</li>
  create a form using the new UI Building that comes with the script editor.
  named:gtest01<br>
  UI compose of:</p>
  
  <ul>
  <li>label, id=label_caption</li>
  <li>button 1, id=button_hide, event-onmouseclick=hide_label</li>
  <li>button 2, id=button_show, event-onmouseclick=show_label</li>
  <li>button 3, id=button_message, event-onmouseclick=message_me</li>
  </ul>
  
  <p>now, the code is:</p>
  
  <pre><code>/* This is so when I want to just deploy it as a [webapp] using the
  script editor -&gt; Publish Deploy as Web App
  */
  function doGet(e) {
   var app = UiApp.createApplication().setTitle("Sheet Application");
    app.add(app.loadComponent("gtest01"));
    Logger.log("Application UI Loaded");  
    return app;
  }
  
  function message_me(e) {  
    Browser.msgBox("my message"); 
  }
  
  function hide_label(e) {
    var app = UiApp.getActiveApplication();
    label =app.getElementById("label_caption");
    label.setVisible(false);
  }
  
  function show_label(e) {
    var app = UiApp.getActiveApplication();
    label =app.getElementById("label_caption");
    label.setVisible(true);
  }
  
  // this code is for when the spreadsheet is shared so they can access the form
  function showform_() {
    var app = UiApp.createApplication();
    app.add(app.loadComponent("gtest01"));
    SpreadsheetApp.getActiveSpreadsheet().show(app); 
  }
  
  function onOpen() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var menuEntries = [];
    menuEntries.push({name: "Show Form", functionName: "showform_"});
    ss.addMenu("e-Test", menuEntries);
  }
  </code></pre>
  
  <p>First scenario is that when spreadsheet is shared</p>
  
  <ul>
  <li>when menu is clicked the form will load - thats good</li>
  <li>when show and hide button nothing happens - why and how can i fixed
  this?</li>
  <li>when message button is click - message will show but the form will
  close, how can I display a message without closing the form?</li>
  </ul>
  
  <p>Second scenario is that when publish as Webapp.</p>
  
  <ul>
  <li>When Developer Link is Access the UI is always updated - ok</li>
  <li>When URL Link is Access the UI is always updated its like it is
  cache, how can I fixed this?</li>
  <li>on dev link: when show and hide button nothing happens - why and how
  can i fixed this?</li>
  <li>on dev link: when message button is click - will generate an error,
  how can I display an alert message on WebApp</li>
  </ul>
  
  <p>Please help I have search and tried the sample codes and answer in the forum am missing something.</p>
  
  <p>Thanks </p>
  
  <p>Nick Ace</p>