Reputation: 2134
I'm trying to render a form with action POST using play 2.10
@form(action = routes.Application.sentiment, args = 'id -> "helloform", 'method -> "POST")
The output for this is (I verified this in play console)
<form action="/sentiment" method="GET" id="helloform" method="POST">
The net effect of this in a browser is it ends up ignoring the second method attribute. What am I doing wrong? How do I override the default form method?
Upvotes: 0
Views: 1241
Reputation: 55798
@form
helper determines form's method
argument on the action's route
, so to change it you should change route
/GET /sentiment controllers.Application.sentiment
to
/POST /sentiment controllers.Application.sentiment
(or vice versa) and do not declare the method in the view.
@form(action = routes.Application.sentiment, args = 'id -> "helloform")
Upvotes: 2