我正在构建一个模块或组件,但我还不确定,但我需要一些依赖于另一个选项的选项。例如,如果您选择“A”,则会出现选项 1、2 和 3。如果您选择“B”,则会出现 4,5 和 6。我可以让所有的东西都出现一次,只是发送,但我可以让一些参数只在选择另一个参数后出现吗?
谢谢你。
我正在构建一个模块或组件,但我还不确定,但我需要一些依赖于另一个选项的选项。例如,如果您选择“A”,则会出现选项 1、2 和 3。如果您选择“B”,则会出现 4,5 和 6。我可以让所有的东西都出现一次,只是发送,但我可以让一些参数只在选择另一个参数后出现吗?
谢谢你。
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