<!DOCTYPE html>
<html lang="en">
<head>
<script>
function populateUser(){
var currUser = "test@yopmail.com";
document.getElementById("txtUserName").value = currUser;
return true
};
</script>
</head>
<body>
<form action="www.somedomain.com" name="loginform" method="post" target="bottom">
<input type="hidden" id="txtUserName" name="txtUserName" value="" />
<input type="submit" name="submit" onsubmit="return populateUser()" value="start logon"/>
</form>
</body>
</html>
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
please move the onsubmit to the form element and not in the submit button:
Open in new window
http://jsfiddle.net/EE_RainerJ/6a0pv2gk/This should do the trick.
HTH
Rainer