[英]Hide custom element in chronoforms based on value selected in radio button
I am using Joomla 3.4.8 and ChronoForms V5.我正在使用 Joomla 3.4.8 和 ChronoForms V5。
I have made a from and I want to hide a custom element based on value of radio button.我做了一个 from 并且我想根据单选按钮的值隐藏一个自定义元素。 I have set two options in radio button Yes and No. I want that If i select Yes then there is custom element (below radio button that contains html table) to be shown and when i click No, the same custom element should be hidden.
我在单选按钮“是”和“否”中设置了两个选项。我希望如果我选择“是”,则会显示自定义元素(在包含 html 表的单选按钮下方),当我单击“否”时,应隐藏相同的自定义元素。
I found too much but there is no option in chronoforms to deal events with custom elements.我发现太多了,但在 chronoforms 中没有选项来处理带有自定义元素的事件。
Some google search came up that i should use "Load Javascript" element at form load and add code to it then call it through event of radio box.一些谷歌搜索出现了我应该在表单加载时使用“Load Javascript”元素并向其添加代码然后通过单选框事件调用它。 I added following code in "Load Javascript" element, and called the event on value Change of radio button but still does not work.
我在“Load Javascript”元素中添加了以下代码,并在单选按钮的值更改时调用了事件,但仍然不起作用。
myFucntion() {
document.getElementById('fin-row-custom2').style.display = 'none';
}
Note: i found id of div using Inspect element in firefox.注意:我在 Firefox 中使用 Inspect 元素找到了 div 的 id。
Any one expert in chronoforms can help me???任何一位chronoforms专家都可以帮助我???
Add a 'wrapping' tag - like a <div>
around your custom code and give it a unique id eg id='show_table'
添加一个 'wrapping' 标签 - 就像一个
<div>
围绕你的自定义代码并给它一个唯一的 id 例如id='show_table'
Then you can show/or hide the <div>
using the Events tab settings in the Radio Box element.然后您可以使用单选框元素中的事件选项卡设置来显示/或隐藏
<div>
。
Bob鲍勃
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.