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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.