Print Page | Close Window

Search Box with Initial Value

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Customizing ProductCart
Forum Description: Exchange messages with other users that are customizing ProductCart.
URL: https://forum.productcart.com/forum_posts.asp?TID=3258
Printed Date: 22-July-2025 at 3:51pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Search Box with Initial Value
Posted By: loracady
Subject: Search Box with Initial Value
Date Posted: 01-December-2009 at 11:44am
I want to have a small search box that has "search keyword or item #" as the initial value.  When a user clicks inside the search box, the initial value is automatically removed and the user can enter a keyword search term or item #.  Has anyone done this? 

-------------
www.TheSleepShop.com



Replies:
Posted By: Greg Dinger
Date Posted: 01-December-2009 at 11:54am
Lora - do a view source on http://www.madcowcutlery.com/ - http://www.madcowcutlery.com/  have a look at the search box.  tehre is a tiny bit of JS in there.

-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: netprofits
Date Posted: 01-December-2009 at 11:56am
Hi loracady, yes, we've done that for several of our clients' sites. See http://www.orchestratedhome.com/shop/pc/home.asp - http://www.orchestratedhome.com/shop/pc/home.asp  as an example.
 
Use something like this for the INPUT field:
<input type="Text" name="keyword" size="18" value="Search..." onfocus="if(this.value=='Search...')this.value='';" >
 
value="" should have the initial value you want displayed.
The onfocus section says that when a visitor clicks on the box, if the value = "Search..." then clear the value. You will need to change the this.value=='Search...' to match the initial value you enter in the value parameter.
 
Does that help?


-------------
NetProfits Internet Consulting

Certified ProductCart Developer

http://www.nicwebdesign.com" rel="nofollow - Our Site


Posted By: katharina
Date Posted: 01-December-2009 at 11:57am
This works with 3.51.
You need to add this to the header.asp or footer.asp depending on where you want it to show.

<!-- Start Search Box -->
<!-- #Include file="SmallSearchBox.asp"-->
<!-- End Search Box -->

Next you open SmallSearchBox.asp in the pc folder and edit it a tiny bit. 
Find the line:
<input type="Text" name="keyword" size="23" value="" id="smallsearchbox" >
and replace with:
<input type="Text" name="keyword" size="23" value="Keyword or Item#" id="smallsearchbox" >

You see I added the Keyword or Item#, but you can change that part to what ever you want.  Do not loose the quotes on either end.  This is just html editing, so no programing needed.

You can see the result at www.germanplaza.com 



-------------
Katharina
*******************
www.GermanPlaza.com
*******************


Posted By: loracady
Date Posted: 01-December-2009 at 12:08pm
Thanks, guys!  You are a bunch of smarties!

-------------
www.TheSleepShop.com



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net