[html-formfu] using formfu as any other perl module. use HTML::FormFu;

Rajeev Prasad rp.neuli at yahoo.com
Thu Jul 28 22:14:11 GMT 2011

Hello,following was originally asked by Bart Lateur on (i guess) the same list. I could not find a solution to his problem. The reason I reproduced his exact question here, is because i have the same problem.

In addition can i have the config data coming from the database too, rather than a yaml (or xml) file?

all the examples i saw were in the context of a webApp.

someone please advice.

thank you.

Bart sorry to reproduce your question here, hope you dont mind.

[html-formfu] I need the most basic tutorial
Bart Lateur
Wed, 12 May 2010 01:16:55 -0700
Though I've worked with similar modules in the past, I find it very hard
to wrap my head around the very basics behind HTML::FormFu. Even the
tutorials I can find on the web (either by external authors, or included
with the module on CPAN) start at a too high level. What I want is a very basic example on how to make a basic CRUD
interface, in a minimal CGI app. I want to do the next thing, *without*
use of *any* external module: no DBIx::Class, no Class::DBI, and
definitely no Catalyst! I want to learn exactly how FormFu is supposed
to work without all this extra bagage. * Data from database: the interface to the DB is external %data = ( id => 1234, foo => "one", bar => "two", yn => 1 ); * Basic form:  auto_fieldset: 1 elements: - type: Hidden name: id - type: Text label: "Foo:" name: foo - type: Text label: "Bar:" name: bar - type: Checkbox label: "boolean:" name: yn default: 0 - type: Submit value: "Update" I'd like to use the same form script for showing the data to the user
and for getting the new values from the user. Business as usual, I would
say. My questions: * How do I put the data from the hash \%data into the form? Should I
use default_values for that? Or something else? process? * I assume I must "process" the input to put the updated data into the
form? * Apparently a partially updated form drops every default value? Is
that correct behaviour? * How do I get the data back out of the processed form, in order to
update the DB? I'm especially worried about that boolean * How do I replace the Checkbox with a pair of radio buttons? Just
replacing "Checkbox" with "Radio" produces an unusable result, and the
docs for  HTML::FormFu::Element::Checkbox are useless. * How does basic validation fit in? How do I flag an error, for
example if text in a field is too long, or contains illegal characters? * Where does validation in Javascript, i.e; without round trip to the
server, fit in? * What's the best way to have a single form for both "add" and "edit",
depending on whether "id" is set or not? * How do you change the way items of the form are rendered, for
example, what if I prefer the form to be in a 2 column table, labels in
column 1, fields in column 2? * What's the best practice to flag to a user a field is required? How
does it fit into FormFu? There's probably more, but nothing I can think of right now... Thank you for you're patients. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110728/a04eee54/attachment.htm

More information about the HTML-FormFu mailing list