in reply to Pre-Populating an HTML form

If it's a straight, unprocessed HTML form, then you're going to have problems. At the very least, you'll need to read the HTML file into a Perl script and use the Perl to insert the $generated_password into the value of the password input. The Perl script would then print an HTML header and print the resulting modified HTML out to the web browser. So instead of loading up http://intranet.yourcompany.com/createuser.html it would be http://intranet.yourcompany.com/createuser.cgi.

If this is unclear, please say so and I will do my best to clarify (or someone else will).

---
It's all fine and dandy until someone has to look at the code.

Replies are listed 'Best First'.
Re^2: Pre-Populating an HTML form
by meinke3 (Acolyte) on Jun 01, 2006 at 21:51 UTC
    Thanks Kwaping, Following your scheme instead of referencing the Create.html like so: <P><A HREF="Admin_fr_create.htm" NAME="fr_body"><B>Create a New Account</B></A></P> I'd do something like create an "Admin_create.cgi" and encapsulate the Javascript and HTML within? I've been looking at PHP, Server Side Includes, Embed Perl and I'm a little overwhelmed. Using your advise, is there an example in the CGI Programming with Perl, the Camel or Cookbook?
      Here's a very small example of the method I described.
      #!/usr/bin/perl use strict; use warnings; use CGI (); my $cgi = CGI->new(); my $infile = '/path/to/file.html'; open my ($fh), '<', $infile or die "Couldn't open $infile! $!"; read $fh, my ($html), -s $infile or die "Couldn't read $infile! $!"; close $fh or die "Couldn't close $infile! $!"; my $generated_password = function_to_generate_password(); $html =~ s/some_special_target_in_your_html_file/$generated_password/s +gi; print $cgi->header(); print $html;
      If you have any questions, don't hesitate to ask!

      ---
      It's all fine and dandy until someone has to look at the code.