views:

57

answers:

1

I am building a module, or component not sure yet, but I need to have a some options that depend on another option. For example, if you choose "A" then options 1, 2 and 3 appear. If you choose "B" then 4,5 and 6 appear. I can make everything appear at once just sending in the but can I make some params only appear after another is chosen?

Thank you.

+1  A: 

This should be reasonably simple to achieve using javascript (i.e. it will run on the user's PC without a round-trip back to the server).

Put all the controls on the form, but for the ones that you do not wish to display initially use the CSS attribute {display:none} and they won't show.

Then use the onclick() event of the control which will determine whether other controls are made visible to show / hide controls as you wish.

There is an example of something similar to this (not within Joomla, but there is no reason (that I can think of) why this won't also work fine within a Joomla module / component) here: http://www.java2s.com/Code/JavaScript/Development/Makebuttoncontrolvisibleorinvisible.htm

Matti