【问题标题】:How to send multiple inputs with the same name, but different value, through GET如何通过GET发送具有相同名称但不同值的多个输入
【发布时间】:2021-09-22 10:46:09
【问题描述】:

如何通过 GET 从同名输入中提交多个值?

效果:

<form action="/gulv-finderen" method="get">
      <button disabled id="submitButton" class="btn">Send</button>
      <input disabled id="inputTaalerVand" type="hidden" name="pf_t_behov" value="Tåler vand" />
      <input disabled id="inputNemMontering" type="hidden" name="pf_t_behov" value="Nem montering" />
      <input type="hidden" name="pf_t_behov_and_condition" value="true" />
</form>

理想情况下,这会显示在 URL 中(当所有都设置为活动时),例如:

/gulv-finderen?pf_t_behov=Tåler+vand&pf_t_behov=Nem+montering&pf_t_behov_and_condition=true

但我得到的是:

/gulv-finderen?pf_t_behov=Nem montering&pf_t_behov_and_condition=true

它只接受1个同名的值。

有什么办法可以防止这种情况,以便我可以提交多个同名输入?

【问题讨论】:

标签: html input get


【解决方案1】:

通过使用locate属性设置自定义URL字符串,并使用JS检查哪些复选框被选中,并在自定义URL中放置字符串来解决它。

谁还需要表格?

【讨论】:

    猜你喜欢
    • 2010-10-03
    • 1970-01-01
    • 1970-01-01
    • 2016-09-10
    • 2014-05-06
    • 2017-08-03
    • 1970-01-01
    • 2017-04-08
    • 2019-09-09
    相关资源
    最近更新 更多