PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Way to clear search input box after submitting search

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Way to clear search input box after submitting search

    Just start using Zoom. Wonderful product. Is there a way to clear the search input box after a user clicks on it? I've tried

    <script language="javascript">
    function cleartext()
    {
    document.form1.textbox.value = ""
    }
    </script>

    <input type="text" name="zoom_query" size="10" value="" onclick="cleartext()">
    <input type="submit" value="Search">

    However, it does not work. Thoughts are appreciated. Thanks in advance.

  • #2
    I assume you are trying to do this for a search form that you have defined in a separate frame from the search results (similar to the method described in our FAQ here: http://www.wrensoft.com/zoom/support...to.html#frames )

    Otherwise this would not really be necessary - when you define your own search form (and disable the one generated by the search script), the form would normally clear the search box automatically.

    Assuming the first scenario is what you are after, then your Javascript method would work although you are missing some important bits. You must specify a name for your form ("form1" according to your JS) and you should refer to the text box by name ("zoom_query") rather than "textbox".

    <script language="javascript">
    function cleartext()
    {
    document.form1.zoom_query.value = "";
    }
    </script>

    <form name="form1" action="search.php" onSubmit="cleartext();">
    ...
    <input type="text" name="zoom_query" size="10" value="">
    <input type="submit" value="Search">
    ...
    </form>
    Hope that helps.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment

    Working...
    X