[html-formfu] newbieFormFu error

Manu Kaul manu.kaul at gmail.com
Fri Mar 20 11:11:13 GMT 2009


Hi All,

I am getting the following error when trying to access addition using
FormFu. Can someone please assist troubleshooting?

Caught exception in jR::Controller::MyApp->add "Can't call method
"submitted_and_valid" on an undefined value at
/home/mkaul/catalyst/jR/script/../lib/jR/Controller/MyApp.pm line 62."

#
# TT file (/home/mkaul/catalyst/jR/root/MyApp)
#

<?xml version=3D"1.0" encoding=3D"utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//D=
TD
XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns=
=3D"
http://www.w3.org/1999/xhtml" xml:lang=3D"en"> <head> <title> Job Applicati=
ons
</title> <link rel=3D"stylesheet" href=3D"[% c.uri_for('/static/main.css') =
%]"
type=3D"text/css" /> </head> <body> <% form %> </body> </html>

#
# JSON Config file (/home/mkaul/catalyst/jR/root/forms/MyApp)
#

{ "id": "create", "auto_id": "%f_%n", "auto_fieldset": 1, "indicator":
"submit", "output_processors": [ "Indent" ], "elements": [ { "type": "Text",
"name": "comp_name", "label": "Company Name", "size": 60, "filters": [
"TrimEdges", ], "constraints": [ "Required", { "type": "Regex", "regex":
'^[0-9A-Za-z-]*$', "message": "ASCII letters, numbers and dashes only" }, ]
}, { "type": "Text", "name": "alias", "size": 20, "label": "Address",
"constraints": [ { "type": "Regex", "regex": '^[0-9A-Za-z-]*$', "message":
"ASCII letters, numbers and dashes only" }, ], }, { "type": "Submit",
"name": "submit", "label": "Done?", "value": "Send this!" } ] }

#
# Main Controller
#


sub add :FormConfig :Local { my ($self, $c) =3D @_;
# Set the TT template to use. You will almost always want to do this # in
your action methods. $c->stash->{template} =3D 'MyApp/add.tt2'; # Get the f=
orm
that the :FormConfig attribute saved in the stash my $form =3D
$c->stash->{form}; # Check if the form has been submitted (vs. displaying
the initial # form) and if the data passed validation. "submitted_and_valid"
# is shorthand for "$form->submitted && !$form->has_errors" if
($form->submitted_and_valid) { # Set a status message for the user
$c->flash->{status_msg} =3D 'Application created'; # Return to the books li=
st
$c->response->redirect($c->uri_for($self->action_for('list'))); $c->detach;
} else { } }





-- =


The greater danger for most of us lies not in setting our aim too high and
falling short; but in setting our aim too low, and achieving our mark.
- Michelangelo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090320/70=
93ff2b/attachment-0001.htm


More information about the HTML-FormFu mailing list