Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to figure out how to have a certain value selected in a popup window show up in a text box in another window. Basically, if I were to click a link on this page a new window would appear with, lets say, a list of colors, each with a checkbox or radio button next to each color. If i select "blue" in the popup window, I'd like "blue" to show up in a text field in the original window. Can all this be accomplished with Perl, or would I have to implement some JavaScript?
  • Comment on transferring field value from a popup window to its main form

Replies are listed 'Best First'.
Re: transferring field value from a popup window to its main form
by chromatic (Archbishop) on Oct 31, 2000 at 06:17 UTC
    Perl is (nearly always) server-side. The web browser is client-side. The two communicate via HTTP requests, not window events. Either the user must send information from the client to the server via following a link or hitting a form submission button, or some sort of client-side scripting (JavaScript) will force the client to send another request.

    Unless you have some sort of push session in the main window and use a Perl script on the server to receive a form submission from the popup window, you're probably not going to find a way to do it in Perl.

    JavaScript and the DOM are the quickest way to get this done -- at least, to my knowledge.

RE: transferring field value from a popup window to its main form
by AgentM (Curate) on Oct 31, 2000 at 06:51 UTC
    I did come up with a perl-only solution, albeit not so efficient or effective; in fact, it's probably not something you want to use, but...you could throw in a refresh on the parent window which would correspond to some script that is clicked on in the child window...of course, the real solution is jscript and with html, this is impossible (as if either are "standards")...
    AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.
Re: transferring field value from a popup window to its main form
by little (Curate) on Oct 31, 2000 at 14:38 UTC
    you might wan't to check the samples for cgi.pm, they cover this issue as well, even though these use javascript and frames it's easy to adapt.