in reply to Re: Pre-Populating an HTML form
in thread Pre-Populating an HTML form

Thanks CountZero. What's tripping me up is how to preload the generated password into the form field.

Replies are listed 'Best First'.
[OT] Re^3: Pre-Populating an HTML form
by jhourcle (Prior) on Jun 02, 2006 at 00:15 UTC

    Well, it all depends on what you have.

    for instance -- if you have SSI (server side includes), you can just do something like:

    <input name='password' value='<!--#include virtual='/cgi/random_password' -->'>

    Another option is to use the whole 'AJAX' concept -- JavaScript to make a call back to the server to ask for a new password, and place it into the field. (of course, then you have a javascript dependancy, and you might as well just do the randomization in JavaScript

    Or, there's the bit that's already been suggested, and just have a CGI to spit out the form. I typically go with this approach, and use the same CGI that generates the backend and initial form, so that I can do data validation, and then re-populate the form, marking any problems.

Re^3: Pre-Populating an HTML form
by CountZero (Bishop) on Jun 02, 2006 at 05:59 UTC
    Sorry, I misunderstood your question.

    You will have to write a (CGI-)script that dynamically generates the webpage on which is your form. CGI.pm is the archetypical module to do this, but there are many other solutions. Ovid's CGI-course (esp. lesson four and lesson six] will give you a lot of valuable pointers. Personally I tend to use now a templating solution (Template Toolkit) for anything but the most trivial applications, but YMMV.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law