Forum Moderators: open
I'm trying to create a form button that when clicked on has to show a new form layer based on the selection of one (out of three) checkboxes selected.
I wrote this code. Let me know how I can fix it.
<head>
<script language="JavaScript">
function N2.click() {
If (document.Mother's Day Donation.Card == "Yes")
{showLayer('page3')}
else
{showLayer('page4')}
}
</script>
</head>
<body>
<form name="Mother's Day Donation">
<input type="checkbox" name="Card" value="Yes" border="0">Mail
<input type="checkbox" name="Card" value="E-card" border="0">E-card
<input type="checkbox" name="Card" value="No" border="0">NO card
<input type=button id=N2 value="NEXT >>" onClick="javascript:N2.click()">
</form>
</body>
The showLayer(lyr) function is setup and functioning in other sections of the form.
Any input will be truly appreciated! Thanks.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<head>
<script language="JavaScript">
function N2click() {
if (document.mdd.Card.checked == true) { showLayer('page3'); }
else { showLayer('page4'); }
}
function showLayer (layerName) { alert(layerName); }
</script>
</head>
<body>
<form name="mdd">
<input type="checkbox" name="Card" value="Yes" border="0">Mail
<input type="checkbox" name="eCard" value="E-card" border="0">E-card
<input type="checkbox" name="noCard" value="No" border="0">NO card
<input type=button id="N2" value="NEXT >>" onClick="N2click()">
</form>
</body>
</html>
Another problem I see is that if you have form elements in other divs (layers) you'll have to do some Javascript to gather them all into one submit, I've had no success in finding a way to show/hide layers in a single form. That is, you can do
<div><form></form></div> <div><form></form></div>
but not
<form><div></div> <div></div></form>
And have the dynamic show/hides work out.
Someone please prove me wrong, I've always worked around this one . . .