我需要直接从表单标记提交属性哈希。这可能吗?
<form action="/members/1/comments" method="post">
[some element] {"coordinator\_id"=>"1", "time"=>"1230", "info_link"=>"cnn.com"}
<submit>Post</submit>
</form>
此哈希值应以'comment'=&gt;的形式到达{“coordinator_id”=&gt;“1”,“time”=&gt;“1230”,“info_link”=&gt;“cnn.com”}
答案 0 :(得分:1)
几乎可能,但不建议,您应该为您的值赋予正确的名称,但这是您要求的:
<form action="/members/1/comments" method="post">
<input name="comment[coordinator_id]" type="hidden" value="1" />
<input name="comment[time]" type="hidden" value="1230" />
<input name="comment[info_link]" type="hidden" value="cnn.com" />
<submit>Post</submit>
</form>