[Pmwiki-users] RE: Search page focus

Jonathan Scott Duff duff
Mon Oct 27 08:16:32 CST 2003


On Sun, Oct 26, 2003 at 03:30:08PM -0000, Dave Jackson wrote:
> Hello
> 
> This works for IE, and I assume any other browser that supports
> VBScript.  (I appreciate that list may not be long :) )
> 
> In local.php, place the following, (lifted straight out of search.php,
> then added to)
> 
> ##code start##
> SDV($HandleActions['search'],'HandleSearch');
> if (isset($EnablePathInfo) && !$EnablePathInfo)
>   SDV($SearchTagFmt,"<form action='\$ScriptUrl' method='get'><input
>     type='hidden' name='pagename' value='\$PageName'><input
> type='hidden'
>     name='action' value='search' /><input type='text' name='text'
> value=''
>     size='40' /><input type='submit' value='$[Search]' /></form><script
> language=\"vbscript\">document.all.text.focus</script>");
> 
> SDV($SearchTagFmt,"<form action='\$PageUrl' method='get'><input
>   type='hidden' name='action' value='search' /><input type='text'
>   name='text' value='' size='40' /><input type='submit'
>   value='$[Search]' /></form><script
> language=\"vbscript\">document.all.text.focus</script>");
> ##code end##
> 
> This adds the bit of client side script to put the focus in the box. 
> It works on the edit page and if you have a search box using [[$Search]]
> mark-up. I assume this is why I had to do it twice.  

Actually, it looks to me like the reason you have to do it twice is
because $SearchTagFmt is subtly different depending on if
$EnablePathInfo false or not.

> More assumptions; SDV is a function in pmWiki.php that expands
> variables, I think.  So I assume that the other 'SDV' functions in
> search.php will work 'as intended' ?

SDV stands for "Set Default Value" I do believe. It gives the variable a
value if and only if the variable doesn't already have a value.  If
this is what you intend, then of course they will work as intended :-)

The only other SDV function I'm aware of is XLSDV which I think sets
translations for a particular language if they haven't already been set.

-Scott
-- 
Jonathan Scott Duff
duff at lighthouse.tamucc.edu



More information about the pmwiki-users mailing list