craftApprentice
craftApprentice

Reputation: 2777

Google apps script UI how to insert message into VerticalPanel()?

I'm trying to write this simple UI which should show a message with two parameters (name, email2send). But, when I run it, I get only this:

enter image description here

The content of the variable msg is not shown in the pannel, only the pannel title. What is the right way to do this?

// Show confirmation 
 function showMSG(name, email2Send) { // for ease of use I give the urls as parameters but you could define these urls in the function as well
  var app = UiApp.createApplication().setHeight(60).setWidth(200);
  app.setTitle("Msg send with sucess!");  
  var msg = "You request to " + email2Send + " a response from " + name;
  app.add(app.createVerticalPanel().setTag(msg));
  var doc = SpreadsheetApp.getActive();
  doc.show(app);
  }

THANKS in advance for any help!

Upvotes: 0

Views: 81

Answers (1)

Serge insas
Serge insas

Reputation: 46822

The TAG of a widget is not visible, its purpose is actually to store string data in a way that is not visible. To show a text use a label or an html widget.

example in your code :

function showMSG(name, email2Send) { // for ease of use I give the urls as parameters but you could define these urls in the function as well
  var app = UiApp.createApplication().setHeight(60).setWidth(200);
  app.setTitle("Msg send with sucess!");  
  var msg = "You request to " + email2Send + " a response from " + name;
  app.add(app.createVerticalPanel().add(app.createLabel(msg)));
  var doc = SpreadsheetApp.getActive();
  doc.show(app);
  }

Upvotes: 1

Related Questions