ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Customizing ProductCart
  New Posts New Posts RSS Feed - Default Search Text
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Default Search Text

 Post Reply Post Reply
Author
Message
knifepro View Drop Down
Newbie
Newbie


Joined: 18-February-2008
Location: United States
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote knifepro Quote  Post ReplyReply Direct Link To This Post Topic: Default Search Text
    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
Back to Top
Greg Dinger View Drop Down
Certified ProductCart Developers
Certified ProductCart Developers
Avatar

Joined: 23-September-2006
Location: United States
Status: Offline
Points: 238
Post Options Post Options   Thanks (0) Thanks(0)   Quote Greg Dinger Quote  Post ReplyReply Direct Link To This Post Posted: 03-January-2013 at 11:43am
Hi Brian - go view the source on 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.
Back to Top
knifepro View Drop Down
Newbie
Newbie


Joined: 18-February-2008
Location: United States
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote knifepro Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Guests View Drop Down
Guest
Guest
Post Options Post Options   Thanks (0) Thanks(0)   Quote Guests Quote  Post ReplyReply Direct Link To This Post 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")%>"
Back to Top
nepcosignsupply View Drop Down
Newbie
Newbie


Joined: 13-April-2011
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote nepcosignsupply Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
Guests View Drop Down
Guest
Guest
Post Options Post Options   Thanks (0) Thanks(0)   Quote Guests Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.