Hi all,
It’s very hot in the UK and my brain has literally melted away. I can’t figure out how to handle form’s submission inside the same function, rather than having the callback function reside in the <head>
.
Here is my desired loginForm()
function:
function handleForm(theForm) {
consol.log('User submitted: ' + theForm.password.value);
}
var htmlFormDiv = hypeDocument.getElementById('formDiv');
htmlFormDiv.innerHTML = '<form name="loginForm" action="javascript:;" onsubmit="return handleForm(this);"><input type="text" id="password" name="password" onfocus="this.value=null" value="Enter password..." required=""><input type="submit" name="Submit" value="Submit"></form>';
If I put the handleForm()
function inside <head>
, it works but I cannot call another function from there, without checking that Hype document has loaded. I’d rather just handle the callback inside my original function. Is this not possible?
I guess what I’m after is a way to somehow call loginForm.handleForm(this).
Thanks,
PJ