所以我想在单击后根据复选框的值启用或禁用日期框。我可以在服务器端做到这一点,如下所示,但似乎无法弄清楚如何在客户端做到这一点。我的问题是如果不调用服务器,我似乎无法访问复选框的值。有任何想法吗?
var chkPaid = app.createCheckBox("Paid in Full").setName("paidInFull").setId("paidInFull");
var dateBox2 = app.createDateBox().setName("paidThrough").setFormat(UiApp.DateTimeFormat.DATE_MEDIUM).setEnabled(false).setId("paidThru");
var paidThruDisable = app.createServerHandler("disableHandler");
paidThruDisable.addCallbackElement(chkPaid);
chkPaid.addValueChangeHandler(paidThruDisable);
function disableHandler(e){
var app = UiApp.getActiveApplication();
var widget = app.getElementById("paidThru");
if(e.parameter.paidInFull !== "true"){
widget.setEnabled(false);
}else{
widget.setEnabled(true);
};
return app;
}