我想在用户在HTML表单上点击'submit'时向请求添加一些查询字符串参数。当前模板文件中的代码:在Phoenix HTML表单的'Submit'按钮中自定义查询字符串参数
<body>
<h2>Create a new email subscription</h2>
<p>This email address will recieve a message when a new order is placed.</p>
<%= form_for @changeset, subscription_path(@conn, :create), fn f -> %>
<label>
Email Address: <%= email_input f, :email_address %>
</label>
<%= submit "Submit" %>
<% end %>
</body>
它好像submit
是为了支持一些opts
,但是,他们没有证件。
https://hexdocs.pm/phoenix_html/Phoenix.HTML.Form.html#submit/2
有没有一种方法,我可以通过其他参数,当用户点击“提交”请求?
你想总是传递额外的参数或点击提交按钮(即不是当只有当用户按下输入字段或使用任何其他方式提交表单)? – Dogbert
无论用户提交表单的方式如何,我都需要这些参数。也许我应该使用'hidden_input' – sheldonkreger
是的,'hidden_input'是要走的路。 – Dogbert