Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Search when pressing enter

    When I press enter on the webpage it wont search, only when the button is clicked.

    <?php if ($keyword) { ?>
    <input type="text" value="<?php echo $keyword; ?>" id="filter_keyword" />
    <?php } else { ?>
    <input type="text" value="<?php echo $text_keyword; ?>" id="filter_keyword" onclick="this.value = '';" onkeydown="this.style.color = '000000'" style="color: #999;" />
    <?php } ?>
    <a onclick="moduleSearch();"><img src="catalog/view/theme/ProShop/image/search_button.png" alt="search" align="top" /></a></div>

    Not sure what to do, hope you can help.

    Thanks, Bevans.

  • #2
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,447
    Thanks
    71
    Thanked 102 Times in 101 Posts
    I don't see the post method anywhere.

    PHP Code:
    <form action="page.php" method="post">
    //Text boxes, submit button, etc
    </form
    That way you can type in the box and press enter.

  • #3
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    This is their problem:

    Code:
    <a onclick="moduleSearch();">
    Not surprising it doesn't catch a key press. This should be in the JS section, btw.

    http://w3schools.com/jsref/dom_obj_all.asp


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •