java - Handling global search box in Play Framework -


on webpage i'd have global search box i.e. search box available on every subpage (let's in header of web page on so). this, putting search form in "base" template used every subpage , works fine. problems start when want show page displays search results. on such page i'd achieve 1 of:

  1. have query string value appear in global search box.
  2. hide global search box (so can put more advanced 1 in result page itself).

to first thing, have provide query string base template. means, have add new parameter base templete every view need such parameter (which empty string of time). right? there simpler way this?

for second thing have detect current url , check if search result page. seems achieve this, have add request parameter base template (which means it's same problem providing query string).

is there simpler approach this?

by way, using java.

  • first can use optionall parameter in base layout like

    @(title: string, query: string = null) 

    so can use in results view like:

    @mybaselayout(title="search results", query=query)  
  • for hiding searchbox on search results can use scala condition or javascript, no magick here
  • you can use separate layout search results

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -