不能在按钮提交处理程序中使用变量
Cannot use variable in button submit handler
我正在尝试创建一个按钮,单击该按钮不仅会提交信息,还会更改按钮的显示文本。我已经完成了提交部分(感谢 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;
}
我已经放置了一个箭头指示给我带来麻烦的线路。当我 运行 脚本时,出现以下错误:"Error Encountered: submitButton is not defined"
我确信这是一件非常简单的事情,但我对脚本编写还很陌生。任何帮助将不胜感激!
function submitHandler_(e) {
var app = UiApp.getActiveApplication();
var submitButton = app.getElementById("YOUR_SUBMIT_BUTTON_ID");
submitButton.setText("Submitted");
...
我正在尝试创建一个按钮,单击该按钮不仅会提交信息,还会更改按钮的显示文本。我已经完成了提交部分(感谢 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;
}
我已经放置了一个箭头指示给我带来麻烦的线路。当我 运行 脚本时,出现以下错误:"Error Encountered: submitButton is not defined"
我确信这是一件非常简单的事情,但我对脚本编写还很陌生。任何帮助将不胜感激!
function submitHandler_(e) {
var app = UiApp.getActiveApplication();
var submitButton = app.getElementById("YOUR_SUBMIT_BUTTON_ID");
submitButton.setText("Submitted");
...