in reply to Re: WWW:Mechanize::FormFiller documentation
in thread WWW:Mechanize::FormFiller documentation

Ok, here's what I need to do:
I am writing these perl scripts for a database I'm developing
which has a series of forms associated with
entering new data into the database. When the user submits
a query to the database he/she will have the option
to edit any of the returned records. If the user chooses to
edit a record I need the script to present the user with the same
form he/she used to enter the data except that all of the
fields will be filled in with the corresponding values from the database.
Entering and retrieving the information from the database is not a problem,
but I just need some way to populate the forms and present them back to the user.
What is the easiest module to use in order to do this?
Thanks again to everyone who has helped me thus far.
  • Comment on Re: WWW:Mechanize::FormFiller documentation

Replies are listed 'Best First'.
Re: Re: WWW:Mechanize::FormFiller documentation
by The Mad Hatter (Priest) on Apr 16, 2003 at 03:48 UTC
    You'll have to generate the HTML for the page and set the value of each form field using the value attribute for the tag. Escaping the data would also be a good idea, and maybe some kind of check to make sure the user didn't enter anything they shouldn't have.

    I usually use HTML::Template to create my, um, HTML templates. The escapeHTML method in CGI should be good enough for escaping data. There might be some module that can do all of this for you, but I don't know about it off hand...

      Ok, so all I have to do is take my originial forms and
      add something like value="<TMPL_VAR NAME=FIELD_VALUE>" to
      each input tag and then use the param() function to set each
      value. Wow, that really is a lot easier than trying
      to figure out how to use WWW::Mechanize::FormFiller. Thanks.
      I'll try not to clog up the forms with any more questions tonight :)
        Yep, much easier. ;-) You'll probably want to make the tag <TMPL_VAR NAME=FIELD_NAME ESCAPE=HTML> so that HTML is escaped. If it isn't escaped, it could lead to problems. Anyway, glad to help.