简体   繁体   中英

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

您可以更新到操作的路由以在那里传递参数,或者将表单映射与相应的参数解析器一起使用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM