Class TextBox


Deprecated. The UI service was deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.

A standard single-line text box.

Here is an example of how to use this widget:


 function doGet() {
   var app = UiApp.createApplication();
   var text = app.createTextBox().setName("text");
   var handler = app.createServerHandler("count").addCallbackElement(text);
   app.add(app.createButton("Count", handler));
   app.add(app.createLabel("0 characters").setId("label"));
   return app;

 function count(eventInfo) {
   var app = UiApp.createApplication();
   // Because the text box was named "text" and added as a callback element to the
   // button's click event, we have its value available in eventInfo.parameter.text.
   app.getElementById("label").setText(eventInfo.parameter.text.length + " characters");
   return app;

Internally, UiApp widgets are built on top of the Google Web Toolkit, and it can sometimes be helpful to look at the GWT documentation directly. You can find the TextBox documentation here.

Deprecated methods

Send feedback about...

Apps Script