+ Reply to Thread
Results 1 to 5 of 5

Thread: How to create a clear button using Jquery for refine search

  1. #1
    Senior Member
    Join Date
    Dec 2011
    Posts
    159

    How to create a clear button using Jquery for refine search

    I been doing this whole night and I still can't get this RESET button ... anyone?

    How to create a Clear button to clear all the fields so that user can do a fresh refine search?


    =========== refine_search.tpl ==================

    <table>
    <tr>
    <td style="padding-{$text_dir_rev}: 10px;"><input class="search_field_item button" type="submit" name="search" value="{$lang.search}" /></td>
    <td><input type="button" class="button" value="Clear Form" id="reset_filter_button" /></td>
    </tr>
    </table>


    <script type="text/javascript">

    {literal}

    $(document).ready(function(){
    $('#reset_filter_button').click(function(){
    eraseCookie('listings_sc');
    listingsGrid.reset();

    $("#filters select option[value='']").attr('selected', true);
    $("#filters input[type=text]").val('');
    $("#Category_ID option").show();
    });

    {/literal}
    </script>
    Last edited by rosegarden; July 29, 2012 at 04:56 PM.

  2. #2
    Hello Desmond,

    Would you please create a new button with id="reset_filter_button" and insert next code in file.
    Code:
    Only registered members can view the code.
    Viktor,
    Flynax technical department,
    Best wishes.

  3. #3
    Senior Member
    Join Date
    Dec 2011
    Posts
    159
    I have tested it does not work well

    Step 1:
    Search field A
    Press "Search

    Step 2 :
    Search result listing appear for field A

    Step 3:
    Press "Reset Search"
    reset ... field A disappear on Refine search box

    Step 4 :
    Change field B
    Press "Search"

    Step 5:
    Search result listing appear for field B
    But on the refine search box, it show field A not B.

    It did not clear the previous session completely. You can test it on my site to confirm my findings

  4. #4
    Hello Desmond Lim,

    Yes you are right. I found problem. Please go to ftp:includes>>controllers>>listing_type.inc.php
    find code:

    PHP Code:
    Only registered members can view the code
    and replace to:

    PHP Code:
    Only registered members can view the code
    Viktor,
    Flynax technical department,
    Best wishes.

  5. #5
    Senior Member
    Join Date
    Dec 2011
    Posts
    159
    Hi Viktor
    Thanks for the fix, it is working now

+ Reply to Thread