Skip Menu |

This queue is for tickets about the CatalystX-ListFramework-Builder CPAN distribution.

Report information
The Basics
Id: 41225
Status: resolved
Priority: 0/
Queue: CatalystX-ListFramework-Builder

People
Owner: OLIVER [...] cpan.org
Requestors: bobtfish [...] bobtfish.net
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.36
Fixed in: (no value)



Subject: Generated javascript does not escape characters
I just tried LFB, and it doesn't work for me. In the generated source, I have javascript looking like: name: 'id' ,id: 'id' ,fieldLabel: 'Id' ,anchor: '-20' ,autoHeight: true ,value: 'nextval('countries_id_seq'::regclass)' So I guess it is failing due to not encoding the ' characters properly.
Patch to fix the JS error by smashing the character attached, I'm sure it is possible to escape also.
Only in CatalystX-ListFramework-Builder-0.36-t0m: Makefile Only in CatalystX-ListFramework-Builder-0.36-t0m: blib diff -ur CatalystX-ListFramework-Builder-0.36/lib/CatalystX/ListFramework/Builder/templates/javascript/update/tabs.tt CatalystX-ListFramework-Builder-0.36-t0m/lib/CatalystX/ListFramework/Builder/templates/javascript/update/tabs.tt --- CatalystX-ListFramework-Builder-0.36/lib/CatalystX/ListFramework/Builder/templates/javascript/update/tabs.tt 2008-09-28 19:22:19.000000000 +0100 +++ CatalystX-ListFramework-Builder-0.36-t0m/lib/CatalystX/ListFramework/Builder/templates/javascript/update/tabs.tt 2008-11-26 01:53:24.000000000 +0000 @@ -38,7 +38,7 @@ ,autoHeight: true [% IF info.cols.$field.default_value %] - ,value: '[% info.cols.$field.default_value %]' + ,value: '[% info.cols.$field.default_value | replace('\'', '_') %]' [% END %] [% UNLESS info.cols.$field.editable %] Only in CatalystX-ListFramework-Builder-0.36-t0m: pm_to_blib
Hi BOBTFISH, On Tue Nov 25 20:47:52 2008, BOBTFISH wrote: Show quoted text
> I just tried LFB, and it doesn't work for me. > In the generated source, I have javascript looking like: > > ,value: 'nextval('countries_id_seq'::regclass)' > > So I guess it is failing due to not encoding the ' characters properly.
In this case I assume you have some kind of auto-incrementing value in the column, e.g. PostgreSQL's SERIAL type? As per the manual page, please can you make sure that your Result Source files contain the "is_auto_increment => 1," option on such columns. This is only added automatically by very recent versions of DBIx::Class::Schema::Loader so you might need to add it manually. Then I think it will work properly. Please let me know how you get on. regards, oliver.
Thanks for the speedy reply! You're correct - they are postgres autoincrement columns, and adding is_auto_increment did the trick for me. Can this be noted more clearly in the beginners docs , as I'd totally missed it (and, as with many people I guess), I tried CX::LFB as it promised to 'just work', and it didn't. Also - there is still nothing stopping me from having the ' character in default values, so I think it needs to be escaped properly to cover all cases. As a silly example, say I was an irish site and I had O'Brien as the default for the 'name' column...
On Wed Nov 26 05:08:56 2008, BOBTFISH wrote: Show quoted text
> You're correct - they are postgres autoincrement columns, and adding > is_auto_increment did the trick for me.
Excellent, glad you have things up and running. Show quoted text
> Can this be noted more clearly in the beginners docs , as I'd totally > missed it
Yes I'd already made a note to do that, I'll bump it up to me more prominent in the docs. Show quoted text
> Also - there is still nothing stopping me from having the ' character > default values, so I think it needs to be escaped properly
You are right, good point, and so I'll leave this RT ticket open to remind me to get around to this. Many thanks for the feedback, regards, oliver.
On Wed Nov 26 05:08:56 2008, BOBTFISH wrote: Show quoted text
> Also - there is still nothing stopping me from having the ' character in > default values, so I think it needs to be escaped properly to cover
all cases. Okay, patch now applied to escape single quote chars in default values. Many thanks for the bug report. regards, oliver.