Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: calling perl subroutine on selecting the values in list box?

by dorward (Curate)
on Apr 27, 2009 at 07:05 UTC ( #760289=note: print w/replies, xml ) Need Help??


in reply to calling perl subroutine on selecting the values in list box?

It isn't, at least not directly. (Unless you are using a client side PerlScript plugin (which I've never seen available for a browser other then MSIE and never seen used in the wild).)

There is an indirect approach though.

  1. Register an onchange event handler using JavaScript.
  2. When it fires make an HTTP request (e.g. with XMLHttpRequest or setting the location property).
  3. Use the information in the request in your server side program to run the routine you want.

A JS library such as YUI will do most of the heavy lifting for you. Make sure you use progressive enhancement to ensure your system is robust.

  • Comment on Re: calling perl subroutine on selecting the values in list box?

Replies are listed 'Best First'.
Re^2: calling perl subroutine on selecting the values in list box?
by citromatik (Curate) on Apr 27, 2009 at 07:23 UTC

    While the original post doesn't require a dynamic (AJAX based) solution, here is a simpler one:

    • 1. (As before) Register an onchange event handler using JavaScript
    • 2. When it fires, call a CGI script, run the desired subroutine and load the resulting page.

    Using a template system like HTML::Template could also be useful.

    citromatik

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://760289]
help
Chatterbox?
[MidLifeXis]: I have a user who has a lot of say on how some of our processes work that abhors significant blanks. Perhaps that is a part of it. A not-so-obvious "this space intentionally left blank" indicator.
[MidLifeXis]: On the back end, however, that doesn't mean that i have to use that value to indicate "undefined", no matter how much he thinks I should.
[stonecolddevin]: hey MidLifeXis, all
[MidLifeXis]: o/
[GotToBTru]: greets

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2017-01-20 19:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (176 votes). Check out past polls.