I'm having a hard time getting this working. I want to create a search
box with a submit button that redirects to the page "/search?q=
{query}". The code I have does not do anything when I click the submit
button. Any help would be appreciated. Thanks!
**html**
<lift:Search>
Search: <search:input/> <search:go/>
</lift:Search>
**snippet**
class Search {
def render(in: NodeSeq): NodeSeq = {
var query = S.param("q") openOr ""
bind("search", in,
"input" -> SHtml.text(query, query = _),
"go" -> SHtml.submit("Search", () => performSearch(query))
)
}
def performSearch(query: String): Unit = {
if(!query.isEmpty) {
S.redirectTo("/search?q="+query)
} else {
S.notice("Please tell us what you're looking for")
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.