[Catalyst] Ajax, Jemplate, forms, rest & data validation

Henry Drinkwater henry.drinkwater at googlemail.com
Fri May 23 23:10:15 BST 2008


Hi,

I'm new to Catalyst so apologies if this is a dumb question. I'm working on
a web site using Catalyst and want to use quite a bit of Ajax interactivity
to make the site as user friendly and modern as possible. The majority of my
knowledge of Catalyst comes from the Jonathon Rockway book, so I have so far
been concentrating on using Jemplate for the AJAX, and using a REST
interface to handle the data serialization.

This is working very nicely for the retrieve/get part, but I am struggling a
bit to figure out the best way of handling forms and the submission &
validation of the data. The formbuilder controller makes it incredibly
simple to build and validate a form, on both the client and the server, and
I want to have similar functionality but AJAX enabled - i.e. I envisage the
form submission method being a PUT to a REST controller, and for the
submission to cause a div to be updated in place, rather than a load of a
new page.

In the book the example uses a POST to a pre-existing formbuilder controller
as the submission method of the ajax form, which is neat in that it handles
the data validation part without writing any code, but not so good in that
it is not really ajax-y, as it results in loading a new page. The book also
mentions putting data validation into the Model and not in the controller,
which I guess would work fine but will require quite a bit more code to be
written. I'd rather not have to write the validation myself if there's a
good module out there which would do it for me, based on the form
definition.

So I'm looking for recommendations as to how to handle this - would I be
better taking the time to learn one of the javascript libraries (e.g. YUI or
Dojo) and moving away from Jemplate, or is there a way to combine
formbuilder and Jemplate in a more dynamic ajax-y way? If anyone has any
suggestions for other tutorials or example code I could look at to get more
ideas of how to do this, I'd be very grateful.

regards,
Henry

ps I have been following the thread on RFC: Catalyst::Controller::REST::DBIC
on the list, which seems to be talking about stuff along these lines, but I
haven't really gleaned any ideas on how best to tackle this. I also found
Jay Shirley's slides on "No REST for the Wicked: Catalyst, REST and YUI"
which sounded very relevant, but again I didn't learn enough to really get
me coding.

pps I found the book incredibly helpful, once I found the errata web site
and got past chapter 3. It got me very quickly over the learning curve on
Catalyst and writing real code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20080523/6b5ad=
edc/attachment.htm


More information about the Catalyst mailing list