amn41
amn41

Reputation: 1154

set parameter in play framework action within template

I have a single input form in a play scala template:

@helper.form(action=routes.Application.searchResult()) {
     <input type="text" name="userQuery" value="@userQuery">
}

and would like to pass an extra parameter, '@channel' to the searchResult action, which it takes as an optional argument.

@channel is passed as an argument to the current template. What's the simplest way to do this?

I tried replacing

routes.Application.searchResult()

with

routes.Application.searchResult(channel=channel)

with no success

Upvotes: 2

Views: 248

Answers (1)

cchantep
cchantep

Reputation: 9168

Either you update the route to the action to pass parameter by there, or you use form mapping with corresponding parameter parser.

Upvotes: -1

Related Questions