我正在尝试创建一个按钮,单击该按钮时,不仅会提交信息,还会更改按钮的显示文本。我已完成提交部分(感谢Google提供的教程),但我仍然坚持使用显示文字。这就是我所拥有的:
// submit form
var submitButton = container.createButton();
submitButton.setText("Submit");
decorateLabel_(submitButton);
// submit handlers
var submitServerHandler = container.createServerClickHandler('submitHandler_');
submitServerHandler.addCallbackElement(vPanel);
submitButton.addClickHandler(submitServerHandler);
function submitHandler_(e) {
submitButton.setText("Submitted"); // <-----------------------------
var app = UiApp.getActiveApplication();
var timeSheet = getFormData_(e);
submitPage_(app,e, timeSheet);
app.close();
return app;
}
我已经放了一个箭头,指示给我带来麻烦的线路。当我运行脚本时,我收到以下错误:&#34;遇到错误:未定义submitButton&#34;
我确信这是一件非常简单的事情,但我对脚本非常陌生。任何帮助将不胜感激!
答案 0 :(得分:1)
function submitHandler_(e) {
var app = UiApp.getActiveApplication();
var submitButton = app.getElementById("YOUR_SUBMIT_BUTTON_ID");
submitButton.setText("Submitted");
...