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

When a form with an id attribute is submitted to a perl script, is that id available to the script?

How do I get the id and assigned it to a variable?

I am familiar with getting the regular input fields from the form, but the id attribute is something I have never had to work with before.

The script needs to check the various fields for accuracy before sending them, along with the original id from the form, to the banking gateway.

Suggestions on how to achieve the above would be much appreciated.

Thanks

Replies are listed 'Best First'.
Re: Using form id attribute in perl script
by Your Mother (Archbishop) on Mar 19, 2015 at 23:12 UTC

    Perl can’t see the client side and HTML element ids are not part of the CGI/form specification so they aren’t sent with plain form submission; just input field name and value pairs.

    It’s pretty easy to add information to form submissions with JavaScript and to do client side validation as well. You should note well however that client side validation is only for convenience and saving on traffic / server hits. You RFC:MUST validate the client data on the server as well. Circumventing client-side security is trivial for a hacker.

    From your description, you’ll need JS. I personally recommend jQuery. You may not need Perl at all if you’re just talking to a bank’s API from the browser.