in reply to Re: Re: Converting Javascript to Perl
in thread Converting Javascript to Perl

Here's what I would do: After they log-in I would grab the page with the checkboxes and hidden fields on it from the remote server. Parse it and get the checkboxes and number fields out (I'd use HTML::TokeParser for that) so they would have checkboxes like the would normally had they actually logged into the remote server.

Theoretically if there are no cookies involved you could simply cause the form to post back to their server (though they would be taken there). If you want them to remain on your site you can use LWP to post the info yourself and send the user back to your own success page (or error page if the Post request to the remote server fails)

All of that is the *best way* as it doesn't require your user to know the numbers. However if you don't want to go to all that trouble and you want the user to enter the numbers the simplest way to add the hidden field would be to use javascript (no one shoot me for putting some JS code here :)). Go ahead and create a hidden field with the correct name but leave its value blank and then do this: (untested!)

<form method="POST" action="somescript.cgi" onSubmit="addHiddenFields( +this)">
And then in your script section:
function addHiddenFields(myform) { myform.delCode1.value = myform.delCheck1.value; }

If you have more than one you can just add them or use arrays and loops to add them dynamically. JS is really quite simple.

Lobster Aliens Are attacking the world!