Tuesday, 10 September 2013

Form fields function call and variable output

Form fields function call and variable output

Hello this is a task of complex form fields processing that I'm trying to
pass to variable and trigger with onclick call - so the result of each
form should be string output within variable :
onsubmit="cartadd(this,detail);"
Any help with this script is really appreciated as this output everything
correctly except final action above that returns undefined..
<script>
var order = function (form) {
var fields = form.querySelectorAll('input');
alert(fields[0].value + ', ' + fields[1].value + ', ' + fields[2].value +
', ' + fields[3].value);
var details = fields[0].value + ', ' + fields[1].value + ', ' +
fields[2].value + ', ' + fields[3].value;
details.toString();
cartadd(details);
}
function cartadd(details) {
var detail= details;
}
</script>

No comments:

Post a Comment