I have a formTemplate and when the user starts typing, the keyboard opens on the iPhone for faster typing. How can I make the button in the formTemplate triggered by the iphone enter button?
Is there any eventListener or similar?
function emailTemplate() {
var template = "<document><formTemplate><banner><description>Enter email for access</description></banner><textField id='email' keyboardType='emailAddress'>Your email</textField><footer><button><text>Submit</text></button></footer></formTemplate></document>";
// var parser = new DOMParser();
// var doc = parser.parseFromString(template , "application/xml");
var templateParser = new DOMParser();
var parsedTemplate = templateParser.parseFromString(template, "application/xml");
var loading = loadingTemplate();
loadingScreen);
pushPage(parsedTemplate, loading);
var email = parsedTemplate.getElementById("email");
parsedTemplate.addEventListener("select", function() { submit(email); });
}
function submit(textField) {
var keyboard = textField.getFeature('Keyboard');
var email = keyboard.text;
if (isValidEmailAddress(email)) {
localStorage.setItem("email", email);
initPage();
} else {
console.log("amail is not valid");
}
}