【问题标题】:Sending forms clears the Get parameters发送表单会清除 Get 参数
【发布时间】:2018-12-01 06:07:41
【问题描述】:

当我点击链接时

<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=)。

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

【问题讨论】:

    标签: django django-templates forms


    【解决方案1】:

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

    看完https://www.w3.org/TR/2011/WD-html5-20110525/association-of-controls-and-forms.html#form-submission-algorithm发现?之后的所有东西都被表单元素替换了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-13
      • 1970-01-01
      • 2020-06-25
      • 1970-01-01
      相关资源
      最近更新 更多