发送表单会清除 Get 参数



当我点击链接时

<a href="?page={{request.GET.page}}&order_by=counter__service__name_service&sort={{ sort_type }}&from_date={{request.GET.from_date}}&from_date={{request.GET.to_date}}&type_water={{request.GET.type_water}}">

所有参数都保存为表单和其余参数,但是当我尝试将参数也保留在表单操作方法中时

<form class="row justify-content-around" id="searchform" action="{% url 'history_application' %}?page={{request.GET.page}}&order_by={{request.GET.order_by}}&sort={{request.GET.sort}}" method="get" accept-charset="utf-8">

它删除它们(网址:history/?type_water=hot&from_date=&to_date=(。

为什么参数不保留在查询中?

我通过添加隐藏输入找到了解决方案。

阅读后 https://www.w3.org/TR/2011/WD-html5-20110525/association-of-controls-and-forms.html#form-submission-algorithm 发现?之后的所有内容都被表单元素所取代。

最新更新