我使用 jqwidgets 创建了一个下拉列表,并使用速度模板获得了一个表单。在表单操作中,我想获取下拉列表的选定值。我需要控制器页面中的值。如何获取速度模板变量中下拉列表的选定值?我在 $submitUrl.setParameter("filePath", "item") 中传递项目。但是如果我在控制器中打印值,那么我只会得到项目。不是下拉列表的选定值。有什么建议吗?
<script type="text/javascript">
$(document).ready(function ()
{
// Create the countryjqxWidget DropDownList
$("#countryjqxWidget").jqxDropDownList({source: countryList, selectedIndex: 0, width: '200', height: '25', theme: 'ui-redmond'});
$('#countryjqxWidget').on('change', function (event)
{
var args = event.args;
if (args) {
// index represents the item's index.
var index = args.index;
var item = args.item;
// get item's label and value.
var label = item.label;
var value = item.value;
alert(value);
var item = $("#jqxDropDownList").jqxDropDownList('getSelectedItem');
}
});
});
</script>
<form id="form" class="form-horizontal" action="$submitUrl" method="post" >
#lr_btn("submit-btn", "Submit", "Submitting...")
</form>
#set( $submitUrl = $renderResponse.createActionURL() )
$submitUrl.setParameter("submit", "upload")
$submitUrl.setParameter("filePath", "item")