Home  |  Linux  | Mysql  | PHP  | XML
From:Varjú_Tamás Date:Mon Jan  7 04:06:44 2008
Subject:Re: How to select from a popup_menu without clicking submit?
This is exactly the point.  Javascript is run in the browser (remotely)
while the perl script is run on the server (locally).  AJAX is the
technique to make this two communicate without submitting the whole
form.

Tamas Varju

2008. 01. 7, hétfĹ‘ keltezéssel 11.01-kor Marcus Claesson ezt írta:
> Thanks for that, but from what I've heard it should be solvable using
> Javascript event handlers. I just don't know the details of how to use
> it successfully. I tried the following but got no result:
> (if this IS the way forward I'd need the onChange (or similar) handler
> to point to a 'Perl event' and not a 'Javascript event'...)
> 
> print $cgi->popup_menu(-name=>'list',
>                        -id=>'list',
>                        -values=>['L1','L2','L3']),
>                        -onChange=>"alert('TESTING')";
> 
> /Marcus
> 
> On Mon, 2008-01-07 at 20:12 +1100, Ken Foskey wrote:
> > On Mon, 2008-01-07 at 08:46 +0000, Marcus Claesson wrote:
> > > Hi!
> > > 
> > > I wonder if there is any way in Perl CGI that you can select an item in
> > > a popup menu and execute a command WITHOUT having to click a submit
> > > button? For instance, this is what I want to do:
> > > 
> > > I have a popup_menu with names of several values.
> > > print $cgi->popup_menu(-name=>'list',
> > >                       -id=>'list',
> > >                       -values=>['L1','L2','L3']);
> > > 
> > > As soon as the user selects a value I want it to be automatically
> > > printed out.
> > > 
> > > if ($cgi->param('list')) {
> > >    print "Selected value: ".$cgi->param('list');
> > > }
> > > 
> > > This is a very basic thing if you allow a submit button, but I don't
> > > want to do that. Any ideas?
> > 
> > 
> > This might be CGI::Ajax.   I have hand coded my ajax so far, it requires
> > javascript knowledge and a real clue stick (mastering ajax on
> > developerworks was my starting point).
> > 
> > -- 
> > Ken Foskey
> > FOSS developer
> > 
> > 
> 
> 

Navigate in group perl.beginners.cgi at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants