Print Page | Close Window

Default Search Text

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=5395
Printed Date: 03-December-2024 at 10:55am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Default Search Text
Posted By: knifepro
Subject: Default Search Text
Date Posted: 03-January-2013 at 11:35am
Can someone tell me how to add default text to the small search box, make it disappear on click and blur?
 
Something like....
 
Search here...
 
Search by Sku or name...
 
Any help would be appreciated.


-------------
Brian

brian@theknifeprofessional.com
brian@heartlandbraidedrugs.com
www.theknifeprofessional.com
www.heartlandbraidedrugs.com
ProductCart v4.7
QuickBooks Sync
Mobile



Replies:
Posted By: Greg Dinger
Date Posted: 03-January-2013 at 11:43am
Hi Brian - go view the source on http://www.shopatdean.com/" rel="nofollow - http://www.shopatdean.com/
 
You will see code associated with the search form.  If you need it physically pulled apart and presented as a solution, I can do that later but I wanted to give you a quick tap in the right direction.


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

Certified ProductCart Developer

Web Design/Development/Hosting

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


Posted By: knifepro
Date Posted: 03-January-2013 at 11:54am
Greg,
 
Thanks for the quick reply. I think I found a solution. So far it is working.
 
Here is what I did just in case anyone else is looking:
 
Somewhere around line 14 in smallsearchbox file you will find:
 
<input type="Text" name="keyword" size="14" value="" id="smallsearchbox" >
 
Replace with:
 
<input type="Text" name="keyword" size="14" value="Text to be displayed here" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" id="smallsearchbox" >


-------------
Brian

brian@theknifeprofessional.com
brian@heartlandbraidedrugs.com
www.theknifeprofessional.com
www.heartlandbraidedrugs.com
ProductCart v4.7
QuickBooks Sync
Mobile


Posted By: Guests
Date Posted: 08-January-2013 at 9:49pm
Hi Brian,

I like the use of the .defaultValue property. It's a bit more elegant that the more literal arguments I've always used.

One other thing I like to do here, though, is to preserve the search phrase entered as a session variable so if the user does a search and then navigates around a bit, they can easily get back to their last search.

Here's the bit of server-side code for that:
'<WMS: store search terms>
if Len(request("keyword")&"") > 0 then
session("keyword") = request("keyword")
end if
if Len(session("keyword") & "") < 1 then
session("keyword") = "Text to be displayed here"
end if

Place that in the ASP section of code right above the search form. Then you'd modify the value property of the input field like so:
value="<%=session("keyword")%>"


Posted By: nepcosignsupply
Date Posted: 23-January-2013 at 10:00am
I don't know if anybody is still watching this, but I tried putting in that code to replace the previous line located around line 14 in smallsearchbox and nothing happened for me. I also tried just changing the value="" to something different and I got nothing. Any suggestions?

-------------
http://www.nepcosignsupply.com/ - http://www.nepcosignsupply.com/


Posted By: Guests
Date Posted: 23-January-2013 at 2:20pm
Have a look at Brian's KnifePro site. You can see it at work there. Compare your script with his and you should be able to dial it in.



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