我有一个表单,我用一个点击处理程序更改`data-params =“save = autosave”。 我可以验证在Chrome的开发工具中进行的DOM更改。当我单击提交时,表单提交正常,但参数不会附加到请求中。
点击之前:
<form accept-charset="UTF-8" action="/practice_scores/17"
class="assessment__answer-form" data-params="save=normal" data-remote="true"
id="edit_practice_score_17" method="post">
</form>
点击后:
<form accept-charset="UTF-8" action="/practice_scores/17"
class="assessment__answer-form" data-params="save=autosave" data-remote="true"
id="edit_practice_score_17" method="post">
</form>
日志:
Started PATCH "/practice_scores/17" for 127.0.0.1 at 2015-02-16 14:37:06 -0800
Processing by PracticeScoresController#update as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"...", "practice_score"=>
{"assessment_id"=>"1", "practice_id"=>"7", "context"=>"respondent",
"score_id"=>"33", "justification"=>"", "future_plan"=>""}, "id"=>"17"}
我很困惑为什么不发送参数。在我的应用程序的另一个地方,我使用JS响应在远程链接上更改data-params
并正确提交。
为什么data-params
会在此表单中被忽略?