[pmwiki-users] jumpbox Javascript guru needed

marc gmane at auxbuss.com
Mon Jan 29 13:54:33 CST 2007


Patrick R. Michaud said...
> On Sat, Jan 27, 2007 at 04:11:35PM -0000, marc wrote:
> > The Javascript used for the jumpbox input tag is as follows:
> > 
> >   http://www.pmwiki.org/wiki/Test/JumpBox
> > 
> >   $InputTags['jumpbox'] = array(
> >     'name' => 'n',
> >     ':html' =>
> >       "<form action='{$PageUrl}' method='get'>
> >        <select onchange='window.location.href=this.options
> > [this.selectedIndex].value'
> >          \$InputSelectArgs>\$InputSelectOptions</select>
> >        <input type='submit' value='$[Jump to page]' /></form>");
> > 
> > The problem is that when using this to jump to a page in a different 
> > group, the URL displayed is of the form:
> > 
> >   http://www.example.com/SomeGroup/JumpFormHerePage?n=Main.HomePage
> > 
> > This causes problems in some circumstances.
> 
> The version that is on Test.JumpBox was just intended as a
> demonstration, not necessarily a full-fledged example.

Any chance of a refund?

> That said, I'm not sure why you'd be getting the second form,
> unless your browser is ignoring the JavaScript for some reason,
> in which case it's the submit button that is causing the problem.
> 
> Is there a page or site where I could see this not working?
> (Feel free to create a demonstration on pmwiki.org.)

Unfortunately, I'm generating the markup via a directive that uses a 
bunch of objects and a couple of dbs, so I don't have a quick method for 
generating a demo. Here's some example generated HTML, though:

<form action='' method='get'>
     <select onchange='window.location.href=this.options
[this.selectedIndex].value'
       name='n'><option value='Main.HomePage'>Home page</option><option 
value='HALion2 Unleashed'>HALion2 Unleashed</option><option value='SX3 
Unleashed'>SX3 Unleashed</option><option value='SX3 Unleashed CD'>SX3 
Unleashed CD</option></select>
     <input type='submit' value='Jump to page' /></form>

It's the Main.HomePage that causes the symptom. The other pages are in 
the same group, clearly, and retain 'sensible' URLs.

Basically, I'm doing this:

  $InputTags['jumpbox'] = array(
  'name' => 'n',
  ':html' =>
    "<form action='{$PageUrl}' method='get'>
     <select onchange='window.location.href=this.options
[this.selectedIndex].value'
       \$InputSelectArgs>\$InputSelectOptions</select>
     <input type='submit' value='$[Jump to page]' /></form>");

  Markup('input-jumpbox', '<split',
  '/\\(:input\\s+jumpbox\\s.*?:\\)(?:\\s*\\(:input\\s+jumpbox\\s.*?:\\))
*/ei',
  "InputSelect(\$pagename, 'jumpbox', PSS('$0'))");

  function ...
    $out = "(:input jumpbox value='Main.HomePage' label='Home page':)";
    if (!empty($member->activeTuts))
      foreach ($member->activeTuts as $product)
        $out .= "(:input jumpbox value='$product' label='$product':)";
    return $out;

-- 
Cheers,
Marc




More information about the pmwiki-users mailing list