我有以下表单,当我单击下一步按钮时,我试图获取隐藏表单字段“kpiValueType”的值。
<script type="text/javascript">
function getGivenFieldValue()
{
var searchFieldVal = jQuery('input:hidden[name="activities[0].kpiList[0].kpiValueType"]').val();
alert(searchFieldVal);
}
</script>
<h:form id="fundRequestForm" action="" method="post">
<ui:repeat value="#{fundRequestBean.requestActivityList}" var="activity" varStatus="stat">
<table width="100%" class="tablesorter">
<thead class="fixedHeader">
<tr>
<th width="418px">
<input type="checkbox" checked="checked" name="activities[#{stat.index}].check" />
#{activity.activityName}
</th>
<th> </th>
</tr>
</thead>
<tbody>
<ui:repeat value="#{activity.kpiList}" var="kpi" varStatus="status">
<tr>
<td>#{kpi.kpiName}<ui:fragment rendered="#{kpi.required=='true'}">
<label style="color: red">*</label>
</ui:fragment>
</td>
<td><div style="text-align: left; padding-top: 5px; padding-bottom: 5px; float: left;">
<input type="text" name="activities[#{stat.index}].kpiList[#{status.index}].kpiValueString"
value="#{kpi.kpiValueString}" size="60" maxlength="50" />
</td>
</tr>
<input type="hidden" name="activities[#{stat.index}].kpiList[#{status.index}].kpiValueType"
value="#{kpi.kpiValueType}" />
</ui:repeat>
</tbody>
</table>
</ui:repeat>
<table width="100%" border="0" bordercolor="#CCCCCC" rules="none" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" align="center">    </td>
</tr>
<tr>
<td>    </td>
<td>    </td>
<td align="right"><div id="nextButtonDiv" style="float: right;">
<h:commandButton
onclick="getGivenFieldValue()"
actionListener="#{fundRequestBean.saveFundRequest}" action="#{fundRequestBean.getPreviewFundRequestData}"
value="#{msg.nextLbl}">
</h:commandButton>
</div>       </td>
</tr>
<tr>
<td colspan="3" align="center">    </td>
</tr>
</table>
</h:form>
从页面源中,我看到隐藏字段 kpiValueType 的名称为
<input type="hidden" name="activities[0].kpiList[0].kpiValueType" value="N" />
警报给我未定义。你能告诉我这里有什么问题吗?我正在使用 jQuery 1.7 和 Firefox 13.0.1