Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8954033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:13:32+00:00 2026-06-15T14:13:32+00:00

I have this UiApp that presents the user with two different options in a

  • 0

I have this UiApp that presents the user with two different options in a dropdown list. User has two options when they select one of them another uiapp comes and displays some information, and it has a button to go back to original Menu. The problem I am having is that when I make the choices I get an error that says “Error Encountered: An unexpected error occurred.” and the same happens when I click the go back button on the option 1 and 2. Is this a bug of GAS, or is it code that shouldnt be there?

Thank you!

 function Menu(e) {
  var app = UiApp.createApplication().setTitle(" Title"); 
  var dropDownList = app.createListBox().setName('list').setId('list');
  var infoLabel = app.createLabel('Scroll around to select the service     desired').setId('infoLabel');
//addItems  
  dropDownList.addItem("Options");
  dropDownList.addItem("Option1");
  dropDownList.addItem("Option2");

  var handler = app.createServerClickHandler('changeMe');
  handler.addCallbackElement(dropDownList);  
  dropDownList.addChangeHandler(handler);
  app.add(dropDownList);
  app.add(infoLabel);
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  spreadsheet.show(app);
  return app;
  }

  function changeMe(e) {
      if(e.parameter.list === 'Option1'){
        var app1 = UiApp.createApplication();
        var html1 = app1.add(app1.createHTML("<p><i>Hello you have selected Option  1</i>    </p>")).setHeight(800).setWidth(600);
        var button1 = app1.createButton('Go back').setId("button1");
        app1.add(button1);
        var handler2 = app1.createServerHandler('Menu');
        button1.addClickHandler(handler2); 
        var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
        spreadsheet.show(app1);
        return app1;
        }

  else if (e.parameter.list === 'Option2'){;
     var app2 = UiApp.createApplication();
     var html2 = app2.add(app2.createHTML("Hello You have selected Option2"));
     var button2 = app2.createButton('Go back').setId("button");
     app2.add(button2);
     var handler2 = app2.createServerHandler('Menu');
     button2.addClickHandler(handler2);                                                                  
     var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
     spreadsheet.show(app2);
     return app2;
     }
   }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:13:33+00:00Added an answer on June 15, 2026 at 2:13 pm

    Try removing the 3 “return app” lines. This seems to work for me. The show method will automatically put it on the spreadsheet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have this query: SELECT HOUR( DATE ) AS hr, COUNT( * ) AS cnt
Have this dictionay retrieving values from DataTable: Dictionary<string,string> meta= ds.Tables[1].Select(key<>'format').AsEnumerable().ToDictionary(k=>k.Field<string>(0),v=>v.Field<string>(1)); How would I apply
I have this piece of code in one of my .jade files: each item
I have this code in jQuery, that I want to reimplement with the prototype
i have this: http://jsfiddle.net/uAQ8B/5/ This list should have all the objects on the left
I have a uiApp that is creating table views from spreadsheet data, but I'm
Let's say we have a Windows app that has a TreeView and you can
I have three c# projects in my solution. One is a console app that
I have a script that allows a user to upload an image to Google
I have this list: <ul class=pagination> <li class=dl-nav-1 current><a href=#>Spring Training 2001</a><span class=visible><img src=img/indicator.png

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.