0

play 2.10 を使用してアクション POST でフォームをレンダリングしようとしています

@form(action = routes.Application.sentiment, args = 'id -> "helloform", 'method -> "POST")

この出力は次のとおりです(プレイコンソールでこれを確認しました)

<form action="/sentiment" method="GET" id="helloform" method="POST">

ブラウザでのこれの最終的な影響は、2 番目のメソッド属性を無視することになります。私は何を間違っていますか?デフォルトのフォーム メソッドをオーバーライドするにはどうすればよいですか?

4

1 に答える 1

2

@formヘルパーmethodはアクションのフォームの引数を決定するrouteため、変更するにはルートを変更する必要があります

/GET    /sentiment  controllers.Application.sentiment

/POST   /sentiment  controllers.Application.sentiment

(またはその逆) ビューでメソッドを宣言しないでください。

@form(action = routes.Application.sentiment, args = 'id -> "helloform")
于 2013-02-11T15:04:43.250 に答える