Hi Bob,
After finding the typo you mention there is also a small typo I think with display block script.
I see before the word display a
' but before the comma I don't see a closing
'But even when I put a ending ' so that it becomes
$('groupfields').set('display', 'block');
I see the following with firebug:
<div id="personfields" display="block">
But with this:
$('personfields').style.display="block";
the html looks like this:
<div id="personfields" style="display: block;">
And this does work.
Feel free to explain the difference. I'm always eager to learn.
Also I had to change
$('radio0').addEvent('change', function() {
To:
$$('input[name=radio0]').addEvent('change', function() {
This I found through searching on the forum. I don't even know why there are two dollar-signs 😶 but it works.
Here is the complete code in case it can help anyone else.
I want to give credit to Bob for helping get to this:
window.addEvent('domready', function() {
$('groupfields').style.display="none";
$('personfields').style.display="block";
$('radio01').checked = true;
$$('input[name=radio0]').addEvent('change', function() {
if ( $('radio01').checked ) {
$('groupfields').style.display="none";
$('personfields').style.display="block";
} else if ( $('radio02').checked ) {
$('groupfields').style.display= "block";
$('personfields').style.display= "none";
} else {
alert("change else");
$('personfields').style.display= "none";
$('groupfields').style.display= "none";
}
});
});
I bought the "ChronoForms creating hideable inputs" so I can add it with Chronoforms book collection. :-)