Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 03:10:39 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155533 Posts in 21713 Topics by 7739 Members
Latest Member: audillino
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: searchbox extra  (Read 584 times)
snark
Guest
« on: January 28, 2010, 04:56:45 PM »

I want to include
 onClick="if(this.value == 'fill in your searchbla here...') { this.value = ''; }" onBlur="if(this.value == '') { this.value = 'Fill in your searchbla here....'; }"

on the textfiel of the searchbox droplet


but I get a red drop...

anyone knows what to change?  in normal code this works fine

Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #1 on: January 28, 2010, 09:14:06 PM »

Hi,

I suggest to post the whole code so coders can take a look.

cheers
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
snark
Guest
« Reply #2 on: January 28, 2010, 09:57:14 PM »

'kay,

Code:
global $TEXT;
$return_value = " ";
if(SHOW_SEARCH) {
    $return_value  = '<div class="box">';
    $return_value  .= '<form action="'.WB_URL.'/search/index'.PAGE_EXTENSION.'" method="get" name="search" class="searchform" id="search">';
    $return_value  .= '<input type="text" name="string" size="22" class="boks" value="fill in your searchbla here..." onClick="if(this.value == 'fill in your searchbla here...') { this.value = ''; }" onBlur="if(this.value == '') { this.value = 'Fill in your searchbla here....'; }" />&nbsp;';
    $return_value  .= '<input name="submit" type="submit" class="buttonq" value="'.$TEXT['SEARCH'].'" />';
    $return_value  .= '</form>';
    $return_value  .= '</div>';
}
return $return_value;
Logged
snark
Guest
« Reply #3 on: February 04, 2010, 05:02:57 PM »

nobody has an idea?

Logged
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #4 on: February 04, 2010, 05:42:42 PM »

Watch the quotes and doublequotes

the '   and the "

text starts with ' and ends with '
so:
Code:
$return_value = ' some text and doublequote " " and singlequotes ' ' ';
will error since the text will be not corrct
you need to escape the ' so it will be parsed as text instead of end of text
Code:
$return_value = ' some text and doublequote " " and singlequotes \' \' ';

Code:
$return_value  .= '<input type="text" name="string" size="22" class="boks" value="fill in your searchbla here..." onClick="if(this.value == \'fill in your searchbla here...\') { this.value = \'\'; }" onBlur="if(this.value == \'\') { this.value = \'Fill in your searchbla here....\'; }" />&nbsp;'
might work


John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!