MyBB Community Forums

Full Version: Hide Setings Javascript
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm working on a plugin, my first for mybb, and was wondering if theres some kind of hook or something that I could use to hide irrelevant settings in the plugin's settings depending on the user's selection.

An example of what I'm talking about is the Board Open/Closed settings, when you select closed the text area appears in order to enter the reason, when you select open, the text area disappears.

The only way I've been able to do this is a source edit to load the peekers, but I'd like to avoid editing the source and do it through the plugin if possible.

Any pointers??
Hi,

it's possible with this two hooks:

admin_config_settings_change
admin_page_output_footer

take a look at this plugin made by me: http://mods.mybboard.net/view/shadowbox
it uses this js-hide-function.
Thanks! That was great help. Lets see if I can get my plugin released today Wink
Glad to hear that I was able to help.
But: Please do not use the same function names as in my plugin. This would collide and none of our plugins can work togehter...
(2009-06-29, 10:40 PM)querschlaeger Wrote: [ -> ]Glad to hear that I was able to help.
But: Please do not use the same function names as in my plugin. This would collide and none of our plugins can work togehter...

Yes yes, I know Wink My functions are different
Ok thats done but now I'm stumped with something else:

I have some settings nested, for example:

-Main Switch (on/off) << Hides/Shows all the settings
---Setting 1 (radio: X/Y)
------Sub-Setting 1 dependent on Setting 1, Shown only if Setting 1 == X
---Setting 2 (on/off)
------Sub-Setting 1 dependent on Setting 2, Shown only if Setting 2 is on
...

Individually the show/hide works great, all the settings show hide as they are supposed to, however when I use the master switch to hide then show all the settings, the Subsettings are always shown.
Any work around? I didn't see anything in peeker to make it watch change in 2 different ids