ここで何かが足りないかどうかはわかりませんが、「validateEmail」を使用する場合は、メールアドレスを小文字にする必要があるようです。以下の私のコードを実行し、名前と大文字の値が付いたメールアドレスを入力すると、送信されません。ただし、大文字の値をすべて削除して小文字にすると、正常に機能します。これが設計によるものなのか、おそらくバグなのか誰かが知っていますか?
function doGet() {
// // Create the signup application
var app = UiApp.createApplication();
//Create vertical panel to hold the widgets
var panelMain = app.createVerticalPanel().setId('mainPanel');
var lblName = app.createLabel('Name:').setId('lblName').setWidth('80px')
.setStyleAttribute("fontFamily","Trebuchet MS")
.setStyleAttribute("fontSize","12pt");
var txtName = app.createTextBox().setName('txtName').setId('txtName').setWidth('300px')
.setStyleAttribute("background-color", "#ffbb00")
.setStyleAttribute("fontFamily", "Trebuchet MS")
.setStyleAttribute("fontSize", "12pt");
var lblEmail = app.createLabel('Email:').setId('lblEmail').setWidth('80px')
.setStyleAttribute("fontFamily","Trebuchet MS")
.setStyleAttribute("fontSize","12pt");
var txtEmail = app.createTextBox().setName('txtEmail').setId('txtEmail').setWidth('300px')
.setStyleAttribute("background-color", "#ffbb00")
.setStyleAttribute("fontFamily", "Trebuchet MS")
.setStyleAttribute("fontSize", "12pt");
var lblRequiredEmail = app.createLabel('*').setId('lblRequiredEmail');
var lblRequiredName = app.createLabel('*').setId('lblRequiredName');
var lblStatus = app.createLabel("Sign up to receive specials and promotions.").setId('lblStatus')
.setStyleAttribute("fontFamily","Trebuchet MS")
.setStyleAttribute("fontSize","12pt");
var btnSubmit = app.createButton("Submit").setId("btnSubmit").setWidth("120px")
.setStyleAttribute("fontFamily", "Trebuchet MS")
.setStyleAttribute("fontSize", "12pt")
var gridMain = app.createGrid(4, 3).setId('gridMain');
gridMain.setWidget(0,0,lblName)
.setWidget(0,1,txtName)
.setWidget(0, 2, lblRequiredName)
.setWidget(1, 0,lblEmail)
.setWidget(1, 1,txtEmail)
.setWidget(1,2,lblRequiredEmail)
.setWidget(2,1,btnSubmit);
panelMain.add(lblStatus).add(gridMain);
//Create server handler for when user submits the information
var serverHandler = app.createServerHandler('Signup')
.validateEmail(txtEmail)
.validateLength(txtName,1,500)
.addCallbackElement(panelMain);
var validateEmail = app.createClientHandler()
.validateNotEmail(txtEmail)
.forTargets(txtEmail).setStyleAttribute("color", "red")
.forTargets(lblRequiredEmail).setVisible(true)
.setText('Invalid Email')
.setStyleAttribute("color", "red");
var validateName = app.createClientHandler()
.validateNotLength(txtName,1,500)
.forTargets(txtName).setStyleAttribute("color", "red")
.forTargets(lblRequiredName).setVisible(true)
.setText('Please Enter Name')
.setStyleAttribute("color", "red");
btnSubmit.addClickHandler(serverHandler).addClickHandler(validateEmail).addClickHandler(validateName);
app.add(panelMain);
return app;
}
function Signup(thisForm)
{
var app = UiApp.getActiveApplication();
var txtName = thisForm.parameter.txtName;
var txtEmail = thisForm.parameter.txtEmail;
var lblStatus = thisForm.parameter.lblStatus;
//Other code to save to data store
////
app.getElementById("lblStatus").setText('Thanks for signing!');
app.getElementById('gridMain').setVisible(false);
return app;
// return app2; //Everything is working fine right now
}