如何知道选择了哪个单选按钮? [英] How to know which Radio Button is selected?
问题描述
var rbutton1 = app.createRadioButton('dist','5 miles');
var rbutton2 = app.createRadioButton('dist','10 miles');
var rbutton3 = app.createRadioButton('dist','25 miles');
在事件处理函数中,变量 e.parameter.dist 只是根据是否选中rbutton3(最后一个单选按钮)给出了真或假。有没有什么方法可以确定单选按钮的选择是准确的?
使单选按钮组工作的唯一方法就是这样按照设计的意图)通过在 FormPanel
中使用它们并从表单的提交动作中查看doPost上的名称(在您的情况下为dist)。
尽管有一些解决方法,使用新的客户端处理程序可以使任何面板上的单选按钮使用情况大体上与使用相同。请参阅此问题在追踪器上。您可能也想要 这个问题,以跟踪更新和投票类型。
I have 3 Radio buttons in my Ui in the same Radio group. They are,
var rbutton1 = app.createRadioButton('dist','5 miles');
var rbutton2 = app.createRadioButton('dist','10 miles');
var rbutton3 = app.createRadioButton('dist','25 miles');
In the event handler function, the variable, e.parameter.dist gives true or false just based on whether rbutton3 (the last radio button) is checked or not. Is there any way to determine what radio button is selected exactly?
The only way the make radio buttons group work like this (as intended by design) is by using them in a FormPanel
and looking the name (in your case "dist") on a doPost from a submit action of the form.
There's some workarounds though, using the new client handlers that make it radio buttons usage on any panel roughly the same as on the from. Please take a look at this issue on the tracker. You may want to star this issue as well, to keep track of updates and kind of vote for it.
这篇关于如何知道选择了哪个单选按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!