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.

Search Module and POST variables?

January 23, 2011 6:17pm

Subscribe [3]
  • #1 / Jan 23, 2011 6:17pm

    Tierra Tech

    2 posts

    Hello,

    I am using the Search Module to make a simple search form that let’s the user search keywords for videos in a video library.
    So far so good.

    However, I would like the user to be able to narrow the search by checking one or two of my two checkboxes called “High Definition” and “Standard Definition”. I thought that I would be able to just have checkboxes in my form, for example:

    <input type="checkbox" name="hq" value="High Quality" checked="checked" >High Quality

    and then have the form post the variables, with a standard

    <form name="form" class="searchform" method="post" action="{site_url}/clients/results">

    The problem is that the {exp:search} does not accept the POST variables in the form, it redirects to a template in the results page with a hash URL like

    results/1deb2acb7c153114e19487249ed2b313/

    and all POST variables seem to be lost. I checked with debugging on and HTTPFox as well and indeed the POST variables got lost, presumably because the search module redirects to the hash URL.

    My question is then, what is the least painful way to get my checkbox values to the Results page when the user hits “Search”?  Is there any way to do this using only the Search Module? How is a good way to approach this problem?


    Thanks

  • #2 / Jan 24, 2011 9:05am

    Sue Crocker

    26054 posts

    Welcome to the ExpressionEngine forums, Corporate B-Roll.

    Since you’re new to the EE forums, have you seen EEWiki:// How to Post a Support Request?

    Can you tell us which version/build of EE2.x you’re using? See EEWiki:// HowTo Determine My EE Version

    Are High Definition and Standard Definition fields or items in a field?

  • #3 / Jan 24, 2011 10:53am

    Tierra Tech

    2 posts

    Hello,

    Thanks for the quick response, I’m new here, so I apologize if I am posting in the wrong place.

    I am Running EE v2.1.3 Build:  20101220

    Yes the videos channel that I am searching has a radio button custom field called “quality” where you can toggle “High Definition” or “Standard Definition” when publishing a video entry.


    Thanks

  • #4 / Jan 24, 2011 3:43pm

    Ingmar

    29245 posts

    I am afraid there is no good way to use the Search Module in such a manner. You could either use a third-party add-on, or even code the query yourself with a bit of PHP. Have you considered using separate channels for these kinds of content? You could then restrict your search to just one channel.

  • #5 / Jan 24, 2011 5:34pm

    Tierra Tech

    2 posts

    Ok Thanks for the help. I guess It’s always worth a try to see if EE will do something for you 😊  I ended up using some ajax to save the states of the checkboxes in a session, then called the session variables in a conditional statement within the {exp:search:search_results}  not very easy, but it works.

  • #6 / Jan 24, 2011 5:48pm

    Ingmar

    29245 posts

    Sounds good. Please post again in case there’s anything else.

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

ExpressionEngine News!

#eecms, #events, #releases