我有一个带有数据和单选按钮的表格,可以检查:接受、待处理、拒绝。在保存时,我想检查是否有任何单选按钮仍处于待处理状态。我怎样才能做到这一点?
单选按钮如下所示:
<td class="fit">
<table>
<tr>
<td class="pad0"><div class=""><fmt:message key='status.registration.registered'/>:</div></td>
<c:if test="${participation.registrationStatus == 2}"><td class="pad0 padL10"><spring:radiobutton path="assignmentFormArray[${i}].registrationStatus" value="2" checked="checked"/></td></c:if>
<c:if test="${participation.registrationStatus != 2}"><td class="pad0 padL10"><spring:radiobutton path="assignmentFormArray[${i}].registrationStatus" value="2"/></td></c:if>
</tr><tr>
<td class="pad0"><div class=""><fmt:message key='status.registration.pending'/>:</div></td>
<c:if test="${participation.registrationStatus == 1}"><td class="pad0 padL10"><spring:radiobutton path="assignmentFormArray[${i}].registrationStatus" value="1" checked="checked"/></td></c:if>
<c:if test="${participation.registrationStatus != 1}"><td class="pad0 padL10"><spring:radiobutton path="assignmentFormArray[${i}].registrationStatus" value="1"/></td></c:if>
</tr><tr>
<td class="pad0"><div class=""><fmt:message key='status.registration.declined'/>:</div></td>
<c:if test="${participation.registrationStatus == 6}"><td class="pad0 padL10"><spring:radiobutton path="assignmentFormArray[${i}].registrationStatus" value="6" checked="checked"/></td></c:if>
<c:if test="${participation.registrationStatus != 6}"><td class="pad0 padL10"<spring:radiobutton path="assignmentFormArray[${i}].registrationStatus" value="6"/></td> </c:if>
</tr>
</table>
</td>
我尝试了以下 Javascript 函数:
function save(){
alert($("input:radio[value='1']:checked"));
}
不幸的是,这不起作用。即使没有选择值为 1 的单选按钮,它也会始终使用对象发出警报。