我对 google-apps-script 很陌生。我遇到了这个错误“TypeError:在对象通用中找不到函数 getValue”,我不知道为什么。
这是代码:
function doGet(e) {
  var app = UiApp.createApplication();
  app.setTitle("My first application");
  var vPanel = app.createVerticalPanel();
  var hPanel3 = app.createHorizontalPanel();
  hPanel3.add(app.createLabel("Text"));
  var textArea = app.createTextArea().setId('theText').setName('theText');
  //textArea.setName("textArea");
  hPanel3.add(textArea);
  vPanel.add(hPanel3);
  var hPanel4 = app.createHorizontalPanel();
  var button = app.createButton("Save");
  var handler = app.createServerHandler('onClick');
  handler.addCallbackElement(textArea);
  button.addClickHandler(handler);
  hPanel4.add(button);
  vPanel.add(hPanel4);
  var label = app.createLabel().setId('label').setText('tata');
  //label.setName("label");
  var hPanel5 = app.createHorizontalPanel();
  hPanel5.add(label);
  vPanel.add(hPanel5);
  app.add(vPanel);
  return app;
}
function onClick(e) {
  var app = UiApp.getActiveApplication();
  // ERROR occurs here when the button is clicked
  var text = app.getElementById('theText').getValue();
  Logger.log(text);
  app.getElementById('label').setValue(e.parameter.textArea + ' toto');
  //label.setText(textArea.getValue());
  return app;
}
我已经更改了 textArea 的名称和 ID,但没有任何效果。
谢谢你的帮助!
中