[Catalyst] Do you dojo?

Toby Corkindale toby at ymogen.net
Fri Jun 2 13:02:57 CEST 2006

Toby Corkindale wrote:
> The widgets haven't proved too hard to grok.. The bit that's proving 
> difficult now is the I/O with the Catalyst backend.

In case anyone else is interested, here's a saveHandler that calls a 
backend handler and passes the changed text to it, and displays output 
(in your template.tt):
<script type="text/javascript">
           function saveHandler(newVal, oldVal) {
               // do something
               var kw = {
                   url:  "[% base %]saveHandler",
                   method: "post",
                   // formNode: dojo.byId("form"),
                   content: { value: newVal },
                   load: function(type, data) {
                       dojo.byId("result").innerHTML = data;
           function init() {
               var editable = dojo.widget.byId("editable");
               editable.onSave = saveHandler;
<p id="editable" dojoType="inlineEditBox">Go on, edit me!</p>

Then in the Catalyst backend:
sub saveHandler : Local {
     my ($self, $c) = @_;
     $c->response->body("<p>This is <em>content</em>:"
                        . $c->req->params->{value}
                        . "</p>");


More information about the Catalyst mailing list