Forums

Hide/Show Form part by radio button

oschikhof 10 Oct, 2015
Hi,

I'm trying to create form that can be used by 2 groups.
A group that is already member and a group that are being introduced...
For the second group I need to have more info, but most of the people who fill in the form
are known.

So I want to have a form that default shows only the necessary fields and when someone
who's new fills in the form, this person selects the radio button of not being a member and once
clicked, the form will show some extra fields that we need.

Somehow i've been searching in the FAQ and forum but I can't seem to find the right topic.
I can't believe that nobody has ever posted this before but perhaps someone can help me
find the solution?

Thanks a lot!

Owen
GreyHead 10 Oct, 2015
1 Likes
Hi Owen,

I assume that you are using ChronoForms v5?

If so you can use the Events tab in the radio button element.

Put the inputs you want to hide/show in a Container and give the Container a unique id. Then use the Event tab settings to hide/show the container and its contents depending on the value of the radio button element.

Bob
oschikhof 12 Oct, 2015
Hi Bob..

Thanks for the info...I'll give it a try a see if can find out how to do this :-)

Gr. Owen
Spionred 27 Oct, 2015

Put the inputs you want to hide/show in a Container and give the Container a unique id. Then use the Event tab settings to hide/show the container and its contents depending on the value of the radio button element.



Hi, I have followed the above with some success. My only issue is that putting the field that is to be hidden/shown in a container means the container shows a label. even if I don't add a label you still get the border and margin. I can see that these are part of the .gbs3 legend class. Is there a way to suppress the class for that container or remove the border and margin.

Cheers,
Kevin.
GreyHead 27 Oct, 2015
1 Likes
Hi Kevin,

It sounds as though you have set the Container to Type - Fieldset. The Div option might work better.

Bob
HerKle 11 Nov, 2015
Hi Bob,
long time, no see.
Today I am struggling with "hide/show".
I looked into the corresponding demo form of CFv5. Unfortunately there the key/value pairs are similar (other=other), so it is hard to understand which side of the equal has to be filled into the "value selected" of the "Events" tab. Of course, mine aren't so simple as "other" and are dynamically created from a db query. So my key eg. is "13" while its value is "Klimahaus Bremerhaven 8° Ost (15,00 €)".
I put the next field into a div-container which should be hidden, if the "Klimahaus etc." radio button is selected. I tried all options, using both "hide" and "hide parent" (without understanding what's the difference) – none of them made the following container disappear. Too bad.
I hope you have an idea.
Regards
GreyHead 12 Nov, 2015
HI Kevin,

First: the part before the = is the value, after the = is the text. The text is shown in the drop-down, the value is submitted when the form is submitted.

Hide is used when you want to hide an input but leave the Label and wrapping HTML in place; Hide Parent hides the whole element - label, input, the lot.

If you are hiding a containing div then you can use Hide as everything inside will be hidden with it.

Bob
HerKle 13 Nov, 2015
Thanks Bob,

additionally to your information it seems that at least two actions have to be mentioned.

In my example I had "if value=13, then hide parent" which didn't do anything. After adding "if value!=13, then show parent" it worked. :-)

Regards,
Herbert
This topic is locked and no more replies can be posted.