Hey all,
I am sure there is a simple way to do this but I am not putting my brain on it.
I have a page that has more than 1 form, the forms can be distinguished by ID, but the elements that live in them can't.
I know it is incorrect to have an id used more than once..... but is it possible for this to work as is or do I need to revisit the way it is laid out?
<form id="form1" onSubmit="return validate_form();>
<input type="text" value="" name="the_quantity" id="the_quantity">
<input type="submit">
</form>
<form id="form2" onSubmit="return validate_form();>
<input type="text" value="" name="the_quantity" id="the_quantity">
<input type="submit" >
</form>
<script type="text/javascript">
function validate_form {
alert(document.getElementById('the_quantity').value);
}
</script>
How would I teach this function to know which "the_quantity" to be looking at? IE the one contained in the form that was submitted?