in reply to Re: Question about CGI and Javascript
in thread Question about CGI and Javascript

1) Learn how CGI.pm works. You can find information at CPAN. If nothing else, learn how to get at the form variables using CGI.pm. Lincoln Stein has published a great book on this subject. (he wrote CGI.pm)
2) It sounds like you already know javascript. This should give you a good start on the DOM (document object module).
3) Use javascript to set form variables on the client, then use those values in your perl cgi script to accomplish the proper goal.

Here is a simple bit of logic to get you started.
For instance, if you have 2 buttons, lets say OK and Cancel, both of which ultimately submit the form. Also, lets say you have a form varriable called button_pressed. To get your CGI to know which button was pressed, have your javascript onClick() handler for each button do whatever pre-submission action it needs to take, and also, have it set the value of button_pressed accordingly. Then, in your CGI script, just query the value of the button_pressed form variable.

Note, there are other ways to accomplish this same thing, this is just one of them.
  • Comment on Re: Re: Question about CGI and Javascript