View Full Version : Way to clear search input box after submitting search
pjablonski
04-09-2005, 04:03 AM
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.
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/faq_howto.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.
Powered by vBulletin® Version 4.1.12 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.