I have the show/hide table rows function working great now (thank you), but I am having a problem with using the back button. If someone has yes to one of the items (yes/no radio buttons) the onClick event in the input tag causes the appropriate info to display. BUT when I submit the form and then hit the back button (to make corrections) then the fields are hidden even though the yes button is clicked. I tried adding the following at the top of my code to initialize them based on the value of the radio button:
function initShowHideRows(idName, clsName)
{
var rgroup = document.getElementById(idName)
var len = rgroup.length;
if (len < 1) return;
for (var j=0; j<len; j++)
{
if((rgroup[j].value=='1')&&(rgroup[j].checked)) showHideRows(clsName,'show');
if((rgroup[j].value=='0')&&(rgroup[j].checked)) showHideRows(clsName,'hide');
}
}
In the code at the top of the page I have the following:
<script language='javascript' type='text/javascript'>
initShowHideRows('pc_parade_float', 'vehreg');
</script>
The showHideRows function works. But the initShowHideRows doesn't seem to. Is just putting the script in the code enough or do I have to do something else to make it work?
Or have I just done something stupid or misunderstand something.
pc_parade_float is the radio group name and 'vehreg' is the class name of the rows that get toggled.
Thanks for your help.
Hal