[Catalyst] formfu->JSON

Paul Tichonczuk pault at digitaldream.ca
Wed Nov 12 17:30:04 GMT 2008

Thanks for the response guys.

I finally got things strait in my head.

General solution. Setup a convention where only json_data gets output
(json config in main pm)
store what I need in json_data
ie json_data = {form: $form.render()};

side note. Jemplate is not compatible with mootools nor prototype.

2008/11/10 Charles Bailey <bailey.charles at gmail.com>:
> On Mon, Nov 10, 2008 at 3:24 PM, Paul Tichonczuk <paultk at gmail.com> wrote:
>> Hi,
>> I'm new to Catalyst.
>> I've gone through both the Catalyst Tutorial and the Catalyst book.
>> I'm trying out FormFu + Jemplate.
>> Basic problem I've come up to is redering a FormFu form into JSON for
>> sending to the client.
>> I keep getting:
>> [error] Caught exception in MyApp::View::JSON->process "encountered
>> object 'MyApp::Controller::Books=HASH(0x9f4406c)', but neither
>> allow_blessed nor convert_blessed settings are enabled at
>> /usr/local/share/perl/5.8.8/JSON/Any.pm line 426."
> It looks as though you're trying to render your controller object into
> the JSON response.  By default, C::V::JSON tries to serialize all keys
> in the stash; have you perhaps stored some object references there?
> If your intent is to render only specific values from the hash, you
> should look at the expose_stash configuration option to C::V::JSON.
> If you do want to serialize object, then you'll need to override the
> default encode_json() and use a JSON encoder with the convert_blessed
> or allow_blessed options set, perhaps combined with TO_JSON() in the
> object class(es).  I've attached a (very underdeveloped and
> underdocumented) utility class that I've found helpful  when dealing
> with simple hash-based classes.
> --
> Regards,
> Charles Bailey
> Lists: bailey _dot_ charles _at_ gmail _dot_ com
> Other: bailey _at_ newman _dot_ upenn _dot_ edu
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/

Paul Tichonczuk  |  tracer.ca

More information about the Catalyst mailing list