Jump to content

Collapse custom field input based on a custom field


Hunter Lyons

Recommended Posts

Posted

I have a custom field called information box. If you turn it on, in my Pages Database, a wiki-style info box appears. 
There are a few other custom fields -- topic spaces, quote content, quote author, etc. Ultimately, it makes this appear, floating to the right of the content area:

 

 

b74344bd14e6acb0b594718e107990fb.png

 

However, all of those other fields are useless if the person disables the information box. With the box disabled, they do nothing.
Because of this, I'm wondering -- is there any way I can make those custom fields disappear when someone disables the info box?

Posted

So how is the output created in the first place? Is it a custom template where you access those fields individually? If so, you would just wrap that entire section with an IF query, so it would only show if the information box checkbox value is set. 

{{if $yourfield}}
//Information box output
{{endif}}

Posted

In the Template, I have that setup -- if someone turns it on, it shows the info box. That part works.
But I mean on the Edit page. Am I able to somehow select the relevant fields and blanket them in an if statement?

13b319794185c54b86f82dc8b95308bd.png

Do you see what I mean? I want to set it up so that when info box is disabled, the fields below it disappear or collapse somehow, since they are not needed in that case.
It's an odd request, but I will likely have laymen editing articles on the wiki, so I want to make sure they're not confused by 10 fields they don't need when the info box is off.

Posted

That’s not so easy. While the IPS framework does support such toggles, they aren’t directly available in the database form. You would have to hard-code that into the Pages form template. 

Or just don’t have that toggle to begin with. You could just as well dynamically show the box just depending on the user input, not a specific setting. 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...