ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Pre-select category dropdown?

March 30, 2010 5:52am

Subscribe [2]
  • #1 / Mar 30, 2010 5:52am

    stephencarr

    38 posts

    I have created a search results page which handles search results from a category page. 

    Users choose a category, type a query and hit search. 

    How can I pre-populate the results page category drop-down with the same category from which they were searching to allow users to quickly run another search on the same category?

  • #2 / Apr 23, 2010 7:44am

    anonymous61630

    93 posts

    Can you pass your category name to the URL? Then you could maybe do something like

    <option {if segment_x == url_title}selected="selected"{/if} value="...">Category</option>
  • #3 / May 12, 2010 6:23pm

    stephencarr

    38 posts

    I don’t think this will work, the search URL structure is like this:

    /{template_group}/{page}/49bd0f39ac15352404dcc6fc53813cdc/

    The large string is obviously the search session number which is made by the system.  Since the form is submitted by POST I can’t append any URL params and if I set up my template to place the cat name in the result page:

    result_page=”/directory/search/{category}”

    The I would end up with a URL like this:

    /directory/search/{category}/49bd0f39ac15352404dcc6fc53813cdc/

    Which does not work in EE.  Really need the cat name/id appended to the end of the URL.

    Edit: Also in the search template if I echo out the $_POST array, it comes back empty which is pretty odd.  I am working in EE 2.0

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases