<html><body><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:10pt"><div class="msgHead">
                        <h1><font style="font-weight: normal;" size="2">Hello,</font></h1>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.<br><br>In addition can i have the config data coming from the database too, rather than a yaml (or xml) file?<br><br>all the examples i saw were in the context of a webApp.<br><br>someone please advice.<br><br>thank you.<br>Rajeev<br><br><span style="background-color: rgb(255, 255, 0);">Bart sorry to reproduce your question here, hope you dont mind.</span><br><br><br><h1><span class="subject">[html-formfu] I need the most basic tutorial</span></h1>
                        <div><span class="sender">Bart Lateur</span><br>
                        <span class="date">Wed, 12 May 2010 01:16:55 -0700</span></div>
                </div>
<pre>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.
</pre></div></body></html>