0
我試圖通過按鈕功能獲取參數。但我得到以下錯誤:創建用戶界面元素E.parameter.widgetName
Encountered Error: TypeError: Can not read property "nameRegister" of undefined
----------
function **createUserPanel**(e){
var ss = SpreadsheetApp.openById(LOGS_SHEET_ID);
var app = UiApp.getActiveApplication();
var absolutePanelReg = app.createAbsolutePanel().setId("absolutePanelReg");
var verticalPanelReg = app.createVerticalPanel().setId("verticalPanelReg");
var mainPanelReg = app.createHorizontalPanel().setId("mainPanelReg");
----------
var lbNameRegister = app.createLabel().setText("Name of user: ");
var nameRegister = app.createTextBox().setId("nameRegister").setName("nameRegister");
var botonSend = app.createButton().setText("Send");
var handlerRegister = app.createServerHandler("createUser")**.addCallbackElement**(verticalPanelReg);
botonSend.addClickHandler(handlerRegister);
----------
verticalPanelReg.add(lbNameRegister);
verticalPanelReg.add(nameRegister);
mainPanelReg.add(verticalPanelReg);
absolutePanelReg.add(mainPanelReg);
app.add(absolutePanelReg);
return app;
};
----------
function **createUser**(e){
/*var nameRegister ="test";*/
var nameRegister = e.paramater.nameRegister;
.......
};
你寫e.paramater.nameRegister;這是你的問題或代碼中的錯字? (e.parameter.nameRegister) –
當我運行腳本並按下按鈕以獲取函數「createUser」參數e.parameter.nameRegister時,出現此錯誤。所以我的腳本不運行和剎車becouse它suppoust,我得到空。我認爲問題是在addcallback控制事件「e」 – tolkedu
對不起,但你沒有回答我的問題......你寫**參數**或**參數**? –