value of input not posted
<script type="text/javascript" language="javascript">
$(function() {
$("#distributor").autocomplete({
开发者_StackOverflow社区 source: function(request, response) {
$.ajax({
url: "/Devices/autoDistributor", type: "POST", dataType: "json",
data: { name: request.term, maxResults: 10 },
success: function(data) {
response($.map(data, function(item) {
return { value: item.Name }
}))
}
})
},
select: function(event, ui) {
//alert(ui.item.value);
}
});
});
</script>
<% using (Html.BeginForm("Filtering","Devices",FormMethod.Post)) {%>
Distributor: <input id="distributor" type="text"/>
<input id="finish_button" type="submit" value="Search" />
<% } %>
When i post form, text who is inserted in input (id="distributor") is not posted, why???
Your <input>
is missing the name
attribute, like this:
<input id="distributor" name="distributor" type="text"/>
Without this, it doesn't get serialized/submitted when the <form>
does :)
精彩评论