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.

Is there a way to pass custom hidden form fields using the simple search form?

January 05, 2012 5:27pm

Subscribe [2]
  • #1 / Jan 05, 2012 5:27pm

    glenndavisgroup

    436 posts

    I’m trying to see if there is a way to pass custom hidden form fields when doing a simple search. Here is a sample code of what I’m trying to do:

    <html>
    <body>
    {exp:search:simple_form channel="mychannel" results="2" no_result_page="search/no_results" result_page="search/results" status="open" search_in="everywhere" id="frmSearch" name="frmSearch"}
    <input type="hidden" name="frmType" id="frmType" value="MyCustomValue" />
    <input type="hidden" name="keywords" id="keywords" value="SomeSearch" />
    {/exp:search:simple_form}
    <script>
    function searchForm()
    {
     var f = document.forms['frmSearch'];
     f.submit();
    }
    searchForm();
    </script>
    </body>
    </html>

    I want to be able to capture the hidden value field from the ‘frmType’ in my results page like this:

    <?php
    echo $_GET['frmType']."
    ";
    ?>
    
    or
    
    <?php
    echo $_POST['frmType']."
    ";
    ?>

    Is this possible?

    Thank you,

    Mike

  • #2 / Jan 05, 2012 5:42pm

    Rob Allen

    3114 posts

    Just switch to using the advanced form tag?

  • #3 / Jan 06, 2012 1:18pm

    glenndavisgroup

    436 posts

    Hi bluedreamer,

    Thanks for the reply but that doesn’t work either? I even tried to call it using the EE API like so:

    <?php
    echo $this->EE->input->get_post('frmType');
    echo $this->EE->input->get('frmType');
    echo $this->EE->input->post('frmType');
    ?>

    Non of the above work? Any other suggestions?

    Thank you,

    Mike

  • #4 / Jan 06, 2012 1:28pm

    Rob Allen

    3114 posts

    Is your custom field marked as being searchable?

  • #5 / Jan 06, 2012 1:45pm

    glenndavisgroup

    436 posts

    Sorry, I should clarify what i mean by “custom field”. This is a not a custom field in the channel it’s simply a hidden form field that I’m adding to the search form and I want to pass it to the results page. Is it possible?

    Thank you,

    Mike

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

ExpressionEngine News!

#eecms, #events, #releases