floppy Posted October 12, 2006 Posted October 12, 2006 What to do if i want that the text in the search field delete itself when i click on it? I think this file is the right one but how to change it? includes/boxes/search.php <?php /* $Id: search.php,v 1.22 2003/02/10 22:31:05 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ ?> <!-- search //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_SEARCH); new infoBoxHeading($info_box_contents, false, false); $info_box_contents = array(); $info_box_contents[] = array('form' => tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'), 'align' => 'center', 'text' => tep_draw_input_field('keywords', '', 'size="18" value="Label/Artist/Title" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') . ' ' . tep_hide_session_id() . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH) . '<br><a href="'); new infoBox($info_box_contents); ?> </td> </tr> </form> <!-- search_eof //-->
GemRock Posted October 17, 2006 Posted October 17, 2006 nobody? :'( You could achieve this by making changes, not in the search.php file, but the tep_draw_input_field function, which, as far as I remember, hsould be in the html_output.php. Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience.
floppy Posted October 18, 2006 Author Posted October 18, 2006 Aaah, thanks for the info! :thumbsup: I found this in html_output.php: // Output a form input field function tep_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) { $field = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"'; if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) { $field .= ' value="' . tep_output_string(stripslashes($GLOBALS[$name])) . '"'; } elseif (tep_not_null($value)) { $field .= ' value="' . tep_output_string($value) . '"'; } if (tep_not_null($parameters)) $field .= ' ' . $parameters; $field .= '>'; return $field; } I found the following code in the net but i can't integrate it correct: onFocus="if(this.value=='here stands anything')this.value=''" onBlur="if(this.value=='')this.value='here stands anything'" Any hints how to do it? :blush:
worldpar Posted March 5, 2007 Posted March 5, 2007 I wanted to do the same thing and here is how I did it. Find the text box you want effected and add this code Change: <form action="http://Website/index.htm" method="post" name="name"> <input type="text" size="30" name="name"/> <input type="submit" value="Text on button" class="button" /> </form> To: <form action="http://Website/index.htm" method="post" name="name"> <input type="text" size="30" name="name" value="Text displayed in text box" onfocus="this.value = '';" /> <input type="submit" value="Text on button" class="button" /> </form> ------------ value="" adds the text you want to display in the text box And Onfocus="this.value=";" removes it when the box is clicked I hope this will help. Thanks Worldpar
Recommended Posts
Archived
This topic is now archived and is closed to further replies.