radio button to hide group

jbyrley

Member
I have just updated from GitHub.

I am having trouble getting the correct response from my form.

I would like

-a group "A" to be hidden upon form load.
-group "A" to show upon selecting value "Yes" on radio button "B" (that is in another group).
-group "A" to hide again upon selecting value "No" on radio button "B".

I have set up javascript on the radio button element as follows:
-on change : When element "B" == "No", hide group "A"
-on change : When element "B" == "Yes", show group "A"

When I go to group "A" layout and change the "Show group" setting to "yes but hidden," it is hidden, but I can't get it to show again using the radio button.

How can I set this form to work as desired?
 
Last edited:
Or to rephrase the question more simply... is there a way to hide a group on a form that will allow that group to be shown and rehidden using radio buttons? I have tried the configuration above, and it doesn't do what I want.
 
If you set the group to hidden, it's hidden and can't be shown.

You must hide it "onload", so add one more JS action to element B
 
Okay I've set it like this
-on load : When element "B" == "No", hide group "A"

This results in the form showing group "A" for an instant, then hiding group "A". Not exactly the behavior I was looking for. Is there a better way so that I can have it hidden from the moment the form loads?
 
That's a known issue, and really just an artifact of making show/hide decisions in JavaScript. The JS can't run and manipulate the DOM until the DOM is loaded ... not a Fabrik thing, that's just how HTML / Javascript works.

http://fabrikar.com/forums/index.php?threads/javascript-renders-too-late.43778/page-2#post-237309

I can probably find a workaround, by adding another option to elements to "start as hidden" which uses the same mechanism the JS show/hide does. The existing "Hidden" option for elements isn't a dynamic thing. Instead of rendering the element as usable (which can then be hidden with CSS classes), we simply add it as a type="hidden", with no rendering.

But it's not as simple as it sounds, and as explained in that post, is work that would need to be funded. It's on list of things to look at, but that's a long list, and things that are funded jump to the top.

I did just think of a potential workaround that would be much easier, and I could do on spec. I'll have a play around and let you know.

-- hugh
 
Okay, thanks. Off topic, I see from your profile you're in Huntsville AL Did you grow up there? I lived there for about 8 years when I was a kid.
 
No, I moved here about 25 years ago, by accident. I'm a Brit. Was taking a sabbatical in 1992, travelling around the world playing music. On my North America leg, I stopped in Huntsville to visit an old college friend from the UK, met a bunch of amazing musicians, fell in love with a bar tender, started a band, got married. Still here. The band is still going. The marriage ended, but we are still great friends, she lives four doors down. I'm in the 5 Points district, the mill village close to downtown.

From your profile pic, I'm guessing your family was either NASA or Army?

-- hugh
 
My dad worked for the Army at Redstone programming missile control systems. We moved away when I was 10. Not as interesting a story as yours! I guess the music connection explains the Snake Doctors in the tutorial.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top