Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Javascript on text box!


Jaskaran

Recommended Posts

Hello!!

 

i put a search box in header with following code.

 

<?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '','id="txtSearch" size="10" maxlength="30" style="width: ' . (BOX_WIDTH+10) . 'px"') . ' ' . tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => BOX_ALL_CATEGORIES)))) . ' ' . tep_hide_session_id() . '<input type="submit" name="Submit" value="Search">' . '</form>'; ?></td>

 

Deafult value of text box in header is "enter search keyword" which is coming form "advanced_search_result.php". now i want put a javascript function to clear the text box value on Click.

 

How and where set the onclick function?

 

Regards

Jaskaran

Link to comment
Share on other sites

Yes sure George Zarkadas!!

 

function hide1()
{
document.advanced_search.keywords.value='';
}

 

1. Put this function in the header of advanced_search.php

2. Near line 170, call this funtion like this..

  $info_box_contents[] = array('text' => tep_draw_input_field('keywords','','onclick="hide1();"','style="width: 100%"' ));     

3.In file advanced_search_result.php

 

near line 124.. find

  if ($error == true) {
   tep_redirect(tep_href_link(FILENAME_ADVANCED_SEARCH, 'keywords', 'NONSSL', true, false));
 }

and put the value of keywords.

 

keywords=Enter Search String'

 

 

All done!

 

Regards

Jaskaran

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...