【问题标题】:<apex:selectRadio> how to avoid multiple selection on radio button?<apex:selectRadio> 如何避免单选按钮上的多选?
【发布时间】:2013-03-22 17:27:51
【问题描述】:

如何避免单选按钮上的多选,我使用了 apex:repeat 并且重复值绑定到控制器的包装类,但是当我选择单选按钮时,它允许多选。

下面是我的代码。

<apex:repeat value="{!availableSlosts}" var="as" id="eventlistId">
                        <tr>
                            <td><apex:selectRadio value="{!as.selectedEvent}">
                                     <apex:selectOptions value="{!as.lstRadioValue}"/>
                                </apex:selectRadio> 
                            </td> 
                            <td>{!as.availDate}</td>

                        </tr>
                    </apex:repeat> 

谢谢,

【问题讨论】:

    标签: radio-button salesforce


    【解决方案1】:

    单选按钮本质上表现出一种选择的唯一行为。但是你可以通过 HTML 和 js 做到这一点。 Code sample here

    【讨论】:

      【解决方案2】:

      {!as.availDate}

                          </tr>
                      </apex:repeat>
      

      应该是这样的

      <apex:selectRadio value="{!as.selectedEvent}">
      
      <apex:repeat value="{!availableSlosts}" var="as" id="eventlistId">
                              <tr>
                                  <td>
                                           <apex:selectOptions value="{!as.lstRadioValue}"/>
      
                                  </td> 
                                  <td>{!as.availDate}</td>
      
                              </tr>
                          </apex:repeat>
      
      </apex:selectRadio>
      

      但在这种情况下,我不知道你会为 selectRadio 标签的 value 属性添加什么。

      【讨论】:

      • 嗨 Chiz/Shimshon Korits,我添加了 java 脚本来取消选择多个单选按钮,它在 MoZilla 中工作正常,但在 Google chrome 中不起作用,下面是我的 smy javascript 代码。函数取消选择(selectObj){ var gettable= document.getElementById('filteredtabledataId'); //警报(可获取); var radios = gettable.getElementsByTagName('input'); for(i=0; i
      猜你喜欢
      • 1970-01-01
      • 2022-01-22
      • 2018-01-26
      • 2010-11-08
      • 2012-07-07
      • 1970-01-01
      • 1970-01-01
      • 2019-10-04
      • 1970-01-01
      相关资源
      最近更新 更多