[pmwiki-users] Clicking Go on search searches for the word Search

wiki question wiki_questions at yahoo.com
Mon Mar 10 13:17:54 CDT 2008


That didn't appear to work:
   
  Here is what I have:
   
  <?php if (!defined('PmWiki')) exit();
  /* alternative searchbox function & markup, with onfocus and onblur events
   fully capable of pmwiki's advanced pagelist and search results functions.
*/
## versiondate: 2006-11-25
  ## redefine searchbox format:
function SearchBox2($pagename, $opt) {
  global $SearchBoxOpt, $SearchQuery, $EnablePathInfo;
 SDVA($SearchBoxOpt, array(
    'size'   => '20',
    'label'  => FmtPageName('$[Search]', $pagename),
    'value'  => str_replace("'", "&#039;", $SearchQuery)));
 $opt = array_merge((array)$SearchBoxOpt, (array)$opt);
 $focus = $opt['focus'];
 $opt['action'] = 'search';
 if($opt['target']) $target = MakePageName($pagename, $opt['target']);
 else $target = $pagename;
 $out = FmtPageName(" class='wikisearch' action='\$PageUrl' method='get'>", $target);
 $opt['n'] = IsEnabled($EnablePathInfo, 0) ? '' : $target;
 $out .= "
   <input type='text' name='q' value='{$opt['value']}' class='inputbox searchbox' size='{$opt['size']}' ";
 if ($focus) $out .= "
    onfocus=\"preval=this.value; this.value=''\"  ";
 $out .= " />
   <input type='submit' class='inputbutton searchbutton' value='{$opt['label']}' />";
 foreach($opt as $k => $v) {
   if ($v == '' || is_array($v)) continue;
   if ($k=='q' || $k=='label' || $k=='value' || $k=='size') continue;
   $k = str_replace("'", "&#039;", $k);
   $v = str_replace("'", "&#039;", $v);
   $out .= "
   <input type='hidden' name='$k' value='$v' />";
 }
 return "<form ".Keep($out)."
  </form>";
}
Markup('searchbox', '>links',
  '/\\(:searchbox(\\s.*?)?:\\)/e',
  "SearchBox2(\$pagename, ParseArgs(PSS('$1')))")


Hans <design5 at softflow.co.uk> wrote:
  Monday, March 10, 2008, 5:51:10 PM, wiki question wrote:

> When I change the following line in skin-fixflow.tmpl
> 

> to 
> 
> 

> It stops replacing my search value with the word "Search" when I click "Go"
> but I have to delete the word search when performing a seach --
> which makes sense based upon your explanation.

The issue is with the focus setting. Try instead of your change above
this:

change in searchbox2.php this:

if ($focus) $out .= "
onfocus=\"preval=this.value; this.value=''\" onblur=\"this.value=preval\" ";

to this:

if ($focus) $out .= "
onfocus=\"preval=this.value; this.value=''\" ";


(removing onblur=\"this.value=preval\")

I think this is a bug in FixFlow. I removed it for the Triad skin,
but must have forgotten to remove it for FixFlow.

~Hans



       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20080310/5a61a42c/attachment-0001.html 


More information about the pmwiki-users mailing list