Reputation: 1528
I have two html pages: /algorithrms
and /algorithms/add
written in scala template. The route file contains following lines:
GET /algorithms controllers.Application.algorithms()
GET /algorithms/add controllers.Application.newAlgorithmForm()
I want to add a button in the page /algorithms
and when I click that button, it simply redirects to the second page /algorithms/add
. I know how to do this in JavaScript. I just want to call an action from the button click and then let the action redirects me to the landing page.
So I added the following code in the first page's html template:
@form(action=routes.Application.newAlgorithmForm()){
<input type="submit" value="Add">
}
It worked, but the landing url is: http://localhost:9000/algorithms/add?
I don't want that question mark. I want to know 1) what I did wrong to cause the question mark to generate and 2) how to remove it?
Upvotes: 0
Views: 1538
Reputation: 5951
I do not know if you use Twitter bootstrap, but hyperlinks can look like buttons too, and the redirect to another page
sounds to me like a plain hyperlink:
<a class="btn" href="@controllers.routes.Application.newAlgorithmForm()" >
@Messages("add.newAlgorithmForm")
</a>
Upvotes: 1