开发者

value of input not posted

开发者 https://www.devze.com 2023-01-11 11:27 出处:网络
<script type=\"text/javascript\" language=\"javascript\"> $(function() { $(\"#distributor\").autocomplete({
<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 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消