Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 2    Views: 82

SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
11/30/15 08:11 AM (8 years ago)

Plugin Developers: Nifty Control Panel Trick: Show/Hide Properties

Hafa Adai Everyone! While developing the Smug Exam Builder plugin, I saw the need to utilize control panel json property values for both the BT Interactive Quiz, and Nad's Advanced Quiz. Both have a fairly robust list of options available to the user, and I needed to display the suggested options without overloading the user with un-needed and possibly confusing options. Meaning, why show the BT Interactive Quiz options, when they're going to use the Nad Quiz? Or Opposite? So I snooped around the net looking for viable solutions, and with a couple of attempts, found something fairly simple that could be easily adapted to BT use. What it does is, depending on the value of a dropdown box, it will display options, and hide others, provided it is in the correct "div" class. I was able to 'encapsulate' all of the BT Interactive Quiz Options, and Nad's Advanced Quiz Options, and hide or display the 'appropriate' choices depending on the Dropdown value. And the dropdown value also saves to json. I threw together a simple Demo here: https://www.marianasgps.com/public/showhide.html.zip unpack that, throw it in a plugin directory, add it to the config_cp.txt file, and take a look at how it works. It's kind of slick. While it may not be of 'immediate' use to everyone, it's always nice to have it in your pocket in case you need it, and it adapts well to other uses too. Cheers! -- Smug
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
11/30/15 01:49 PM (8 years ago)
Excellent. Smug, thank you very much!
 
aussiedra
Code is Art
Profile
Posts: 431
Reg: Dec 25, 2010
Brisbane, Austr...
8,260
like
11/30/15 07:57 PM (8 years ago)
slick in deed man i wish i knew php/html :-(
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.