如何使按钮仅在按下时发送名称和值?

时间:2019-05-03 07:53:15

标签: html

我有一个带有表单内提交按钮的表单


<script>
$(function(){
  $('[data-toggle="tooltip"]').tooltip();
});
</script>

    <div class="container-fluid  " style="margin-top: 15px">
    <div class="row d-flex flex-row align-baseline">

    <div class="col-2">
       <form action="{% url "boats:boats" %}" method="get" name="form1" id="1">
<select class="custom-select" name="ordering">


  <option selected value="">{% firstof   verbose_name 'select ordering pattern' %} </option>


  <option value="boat_publish_date">--by publish date</option>
  <option value="author">--by author</option>
  <option value="boat_length">--by boat length</option>
    <option value="boat_mast_type">--by boat rigging </option>
    <option value="boat_price"> --by price</option>
    <option value="boat_country_of_origin">--by country</option>
    <option value="boat_keel_type">--by keel type</option>
    <option value="first_year">--by first year of model manufacturing time range </option>
    <option value="last_year">--by last year of model manufacturing time range </option>
</select>
       </div>

        <div class="col-2">
   <select class="custom-select" name="mark">
  <option value="descending">--in descending order</option>
  <option value="ascending">--in ascending order</option>
</select>
</div>

<div class="col">


    <button type="submit" value="on" class=" btn secondary border-primary mt-0 btn-sm" data-toggle="tooltip" data-placement="right" title="Apply ordering" name="button"    > Apply ordering </button>

</form>
</div>



问题是按钮的名称和值在请求中。按下按钮时,重新加载页面时,切换分页器页面时等等,获取数据。换句话说,是否按下按钮没有区别–名称无论如何,值都在GET数据中。 问题是–仅在按下按钮并将所有其余情况分开时,才可能使按钮发送名称和值吗?

谢谢!

0 个答案:

没有答案