Posting values in multiple forms separately with single function
I have a task with a form that requests posting values in multiple forms
separately by getting field values, all with single event function applied
at each form submit call, so there could be multiple forms on page with
same identifiers. Please review this working example that handles only
values of first field and suggest something in generic javascript if
possible.
<script>
function Order() {
var formi=document.getElementById("test").value;
document.getElementById("result").value=document.getElementById("test").value;
alert(formi);
}
</script>
<form onsubmit="Order();return false;">
<input type="text" id="test" value="">
<input type="text" id="result" value="">
<input type="submit" value="Order">
</form>
<form onsubmit="Order();return false;">
<input type="text" id="test" value="">
<input type="text" id="result" value="">
<input type="submit" value="Order">
</form>
No comments:
Post a Comment