But the function relies on "onclick" does it not? Therefore, if an item is selected as "checked" by default it won't run the onclick function will it.
Also, how do I change that function example you've provided to cope with more than two scenarios? I thought elseif might do it, but I think I'm trying to apply Classic ASP thinking to this type of thing and it, clearly, doesn't work...this is what I'm trying (that isn't working):
The function:
<script>
function hideorshow() {
if (document.getElementById('TMSAmembershipratesID1').checked) {
document.getElementById('reveal-if-notfamily').style.display = 'block';
} else if (document.getElementById('TMSAmembershipratesID2').checked) {
document.getElementById('reveal-if-notfamily').style.display = 'block';
} else if (document.getElementById('TMSAmembershipratesID3').checked) {
document.getElementById('reveal-if-notfamily').style.display = 'block';
} else if (document.getElementById('TMSAmembershipratesID4').checked) {
document.getElementById('reveal-if-family').style.display = 'block';
} else if (document.getElementById('TMSAmembershipratesID5').checked) {
document.getElementById('reveal-if-notfamily').style.display = 'block';
}
}
</script>
The CSS...
#reveal-if-family {
display: none;
}
#reveal-if-notfamily {
display: none;
}
The form...
<form>
<label class="col-sm-4 control-label" for="TMSAmembershipratesID">Type of Membership:</label>
<div class="col-sm-8">
<div class="radio">
<label class="control-label" for="TMSAmembershipratesID">
<input type="radio" name="TMSAmembershipratesID" id="TMSAmembershipratesID1" value="Individual Standard" checked onclick="hideorshow();">
Individual Standard (£20.00 per year)
</label>
</div>
<div class="radio">
<label class="control-label" for="TMSAmembershipratesID">
<input type="radio" name="TMSAmembershipratesID" id="TMSAmembershipratesID3" value="Individual Premium" onclick="hideorshow();">
Individual Premium (£50.00 per year)
</label>
</div>
<div class="radio">
<label class="control-label" for="TMSAmembershipratesID">
<input type="radio" name="TMSAmembershipratesID" id="TMSAmembershipratesID2" value="Individual Concession" onclick="hideorshow();">
Individual Concession (£15.00 per year)
</label>
</div>
<div class="radio">
<label class="control-label" for="TMSAmembershipratesID">
<input type="radio" name="TMSAmembershipratesID" id="TMSAmembershipratesID4" value="Family" onclick="hideorshow();">
Family (£30.00 per year)
</label>
</div>
<div class="radio">
<label class="control-label" for="TMSAmembershipratesID">
<input type="radio" name="TMSAmembershipratesID" id="TMSAmembershipratesID5" value="Affiliate" onclick="hideorshow();">
Affiliate (£30.00 per year)
</label>
</div>
</div>
</form>
The Hide/Reveal stuff..
<div id="reveal-if-family">
<p>Form fields in here.</p>
</div>
<div id="reveal-if-notfamily">
<input name="form2NDADULT" id="form2NDADULT" type="hidden">
<input name="form1STCHILD" id="form1STCHILD" type="hidden">
<input name="form1STCHILDDOB" id="form1STCHILDDOB" type="hidden">
<input name="form2NDCHILD" id="form2NDCHILD" type="hidden">
<input name="form2NDCHILDDOB" id="form2NDCHILDDOB" type="hidden">
<input name="form3RDCHILD" id="form3RDCHILD" type="hidden">
<input name="form3RDCHILDDOB" id="form3RDCHILDDOB" type="hidden">
</div><!-- end reveal-if-notfamily -->
Thank you.
NJ