Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Pre-fill general search field


velvetpixel

Recommended Posts

Posted

I want to pre-fill the general search field with:

 

Find what you want today

 

I would like the text to disappear when someone clicks in the search box to start typing.

 

I know in a regular form I could use something like:

value="Find what you want today" onFocus="this.value='';" onBlur="if(this.value=='') this.value='Find what you want today';"

 

 

But the osCommerce form uses this:

<?php
echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get');
echo tep_draw_input_field('keywords', '', 'size="10" maxlength="64" style="width: 300px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description', '1');
?>

 

How can I customize just the general search field?

Posted

Change the input field line to this:

 

echo tep_draw_input_field('keywords', '', 'size="10" maxlength="64" style="width: 300px" value="Find what you want today" onFocus="this.value=\'\';" onBlur="if(this.value==\'\') this.value=\'Find what you want today\';"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description', '1');

Regards

Jim

See my profile for a list of my addons and ways to get support.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...