Joomla! 中的自定义选项组件帮助
我正在构建一个模块或组件,但还不确定,但我需要一些依赖于另一个选项的选项。例如,如果您选择“A”,则会出现选项 1、2 和 3。如果您选择“B”,则会出现 4,5 和 6。 我可以让所有内容立即显示,只需发送,但我可以让某些参数仅在选择另一个参数后才显示吗?
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 javascript 可以相当简单地实现这一点(即,它将在用户的 PC 上运行,无需往返服务器)。
将所有控件放在表单上,但对于那些您不希望显示的控件,最初使用CSS属性{display:none},它们将不会显示。
然后使用控件的 onclick() 事件,该事件将确定其他控件是否可见,以根据需要显示/隐藏控件。
这里有一个与此类似的示例(不在 Joomla 内,但没有理由(我能想到)为什么这在 Joomla 模块/组件中不能正常工作): http://www.java2s.com/Code/JavaScript/Development/Makebuttoncontrolvisibleorinvisible.htm
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