This website uses cookies to ensure you get the best experience. Learn More.
Using liferay-ui:search-toggle - with Basic or Advanced Search only
I was using <liferay-ui:search-toggle> tag, and my requirement was to to show only advanced search and no basic search. but by default <liferay-ui:search-toggle> will show basic search unless and until user clicks the advanced search atleast once. I tried all possible ways and finally found the solution, this what i did to make my <liferay-ui:search-toggle>show only "Advanced Search" without "Basic" search toggle link.So what we need to do is,
<style type="text/css"> .toggle-link {display: none;} </style>
This style overriding will prevent the "<<Basic" search link form being displayed, the next piece of code snippet will make the "Advanced" search displayed by default, we are a kind of triggering the Search link click .... String key = "<replace with the id of your <liferay-ui:search-toggle> tag"; SessionClicks.put(request, key,"advanced"); .....
The key piece of code which does sends signal to the underlying liferay code to show only "advanced" is SessionClicks.put(request, key,"advanced");
The same could be achieved when we want to display only basic search and no advanced search just by changing the "advanced" --> "basic"
That is it, once we have done with this our <liferay-ui:search-toggle> will always display only "Advanced" or "Basic" search