From xaos at darksmile.net Tue Sep 6 04:42:07 2011 From: xaos at darksmile.net (George Hrysanthopoulos) Date: Tue Sep 6 04:42:20 2011 Subject: [html-formfu] Quick question Message-ID: <4E65A49F.6070205@darksmile.net> Hello everyone, can anyone tell me why this: - type: Block elements: - type: Src content: "lll" Produces this:
<a href=3D"linux">lll</a>
Instead of:
lll
All I want to do is add a few HTML tags between checkboxes. -George H. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110906/f2= a5c742/attachment.htm From dougorleans at gmail.com Tue Sep 6 05:17:06 2011 From: dougorleans at gmail.com (Doug Orleans) Date: Tue Sep 6 05:17:31 2011 Subject: [html-formfu] Quick question In-Reply-To: <4E65A49F.6070205@darksmile.net> References: <4E65A49F.6070205@darksmile.net> Message-ID: Try content_xml instead of content. http://search.cpan.org/~perler/HTML-FormFu-0.09004/lib/HTML/FormFu/Element/Block.pm#content_xml --Doug On Tue, Sep 6, 2011 at 12:42 AM, George Hrysanthopoulos wrote: > Hello everyone, > > can anyone tell me why this: > > ? - type: Block > ??? elements: > ??? - type: Src > ????? content: "lll" > > Produces this: > >
<a href="linux">lll</a>
> > Instead of: >
lll
> > > All I want to do is add a few HTML tags between checkboxes. > > -George H. > > _______________________________________________ > HTML-FormFu mailing list > HTML-FormFu@lists.scsys.co.uk > http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu > From xaos at darksmile.net Sat Sep 10 17:51:30 2011 From: xaos at darksmile.net (xaos@darksmile.net) Date: Sat Sep 10 17:51:37 2011 Subject: [html-formfu] Quick question In-Reply-To: References: <4E65A49F.6070205@darksmile.net> Message-ID: <20110910115130.48274bgzz10htllu@host111.hostmonster.com> Doug, You are a life saver! That worked perfectly. -George Quoting Doug Orleans : > Try content_xml instead of content. > > http://search.cpan.org/~perler/HTML-FormFu-0.09004/lib/HTML/FormFu/Element/Block.pm#content_xml > > --Doug > > On Tue, Sep 6, 2011 at 12:42 AM, George Hrysanthopoulos > wrote: >> Hello everyone, >> >> can anyone tell me why this: >> >> ? - type: Block >> ??? elements: >> ??? - type: Src >> ????? content: "lll" >> >> Produces this: >> >>
<a href="linux">lll</a>
>> >> Instead of: >> >> >> >> All I want to do is add a few HTML tags between checkboxes. >> >> -George H. >> >> _______________________________________________ >> HTML-FormFu mailing list >> HTML-FormFu@lists.scsys.co.uk >> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu >> > > _______________________________________________ > HTML-FormFu mailing list > HTML-FormFu@lists.scsys.co.uk > http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu > From catalyst at s.profanter.me Tue Sep 13 10:41:28 2011 From: catalyst at s.profanter.me (Stefan) Date: Tue Sep 13 10:41:36 2011 Subject: [html-formfu] Localize value Message-ID: <000001cc7201$b372ca00$1a585e00$@s.profanter.me> Hi, I'm using Catalyst with FormFu. Now I want to localize also the values. Localizing labels is already working with label_loc. But there is no such function for values (like value_loc). Eg: I hav a select field: - type: Select name: type label_loc: type To localize the values I use the following code in my Catalyst controller: $form->get_element({name => 'type'})->options([ [1,$c->loc('request')], [2,$c->loc('booking')] ]); This is working, but is there a better solution?? But this method istn't working if I have multiple radio buttons: #Breakfast - type: Radio name: breakfast label_loc: breakfast - type: Radio name: breakfast These two buttons have the same name because they should be a group (Know already about Radiogroup, but Radiogroup has the strange Border and Title). How can I set the values on these two radio buttons? $form->get_all_elements({name => 'breakfast'}) is always returning an empty array. I want to set one to Yes and the other to No (localized). Thanks for your help!! Stefan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110913/98299b44/attachment.htm From catalyst at s.profanter.me Tue Sep 13 11:29:57 2011 From: catalyst at s.profanter.me (Stefan) Date: Tue Sep 13 11:30:02 2011 Subject: AW: [html-formfu] Localize value In-Reply-To: <000001cc7201$b372ca00$1a585e00$@s.profanter.me> References: <000001cc7201$b372ca00$1a585e00$@s.profanter.me> Message-ID: <000501cc7208$7755fa90$6601efb0$@s.profanter.me> Found now a better solution for the single Radio-Buttons: I use them in a Radiogroup and remove the border by css. I think the problem with options localization can be solved like this: #Breakfast - type: Radiogroup name: breakfast label_loc: breakfast options: - value: '1' label_loc: yes - value: '0' label_loc: no The same with the select field: # Request type - type: Select name: type label_loc: type options: - value: '1' label_loc: request - value: '2' label_loc: booking So this solution works. Don't know if there is a better solution. But thanks anyway!! Stefan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110913/e5e19b27/attachment.htm From orasnita at gmail.com Tue Sep 13 11:48:48 2011 From: orasnita at gmail.com (Octavian Rasnita) Date: Tue Sep 13 12:08:14 2011 Subject: [html-formfu] Localize value References: <000001cc7201$b372ca00$1a585e00$@s.profanter.me> Message-ID: Hi Stefan, From: Stefan = Hi, I'm using Catalyst with FormFu. Now I want to localize also the values. Localizing labels is already work= ing with label_loc. But there is no such function for values (like value_lo= c). ** There is value_loc for the values which are displayed on the page, like t= he value of a submit element. I don't know if there is a value_loc option for select/radio elements bec= ause I never needed such a thing, but if there is not, you can get the loca= lized value after submitting the form and in the form print just the key yo= u want to localize (because the users can't see that key anyway). Octavian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110913/22= b4b15c/attachment.htm From catalyst at s.profanter.me Tue Sep 13 12:36:25 2011 From: catalyst at s.profanter.me (Stefan) Date: Tue Sep 13 12:36:30 2011 Subject: AW: [html-formfu] Localize value In-Reply-To: References: <000001cc7201$b372ca00$1a585e00$@s.profanter.me> Message-ID: <000f01cc7211$c0a23c50$41e6b4f0$@s.profanter.me> Hi Octavian, >I don't know if there is a value_loc option for select/radio elements because I never needed such a thing, but if there is not, you can get the localized value after submitting the form and in the form print just the key you want to localize (because the users can't see that key anyway). Sorry, I miswrote it a little bit. The value_loc exists for eg the submit button. But if I want to localize an options array I have to do it by the long way mentioned in the post before. It seems that there is no options_loc (Post from 2007: http://lists.scsys.co.uk/pipermail/html-formfu/2007-October/000640.html). I need the localization with options to generate localized html code like the following: And # Request type - type: Select name: type label_loc: type options: - value: '1' label_loc: request - value: '2' label_loc: booking is doing this job. Thanks anyway for your response! Stefan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110913/5e5e6d6c/attachment.htm From fireartist at gmail.com Tue Sep 13 12:58:19 2011 From: fireartist at gmail.com (Carl Franks) Date: Tue Sep 13 12:58:24 2011 Subject: [html-formfu] Localize value In-Reply-To: <000001cc7201$b372ca00$1a585e00$@s.profanter.me> References: <000001cc7201$b372ca00$1a585e00$@s.profanter.me> Message-ID: On 13 September 2011 11:41, Stefan wrote: > Hi, > > I?m using Catalyst with FormFu. > > Now I want to localize also the values. Localizing labels is already working > with label_loc. But there is no such function for values (like value_loc). > > > > Eg: I hav a select field: > > > > ??? - type: Select > > ????? name: type > > ????? label_loc: type > > > > To localize the values I use the following code in my Catalyst controller: > > ?????????????? $form->get_element({name => 'type'})->options([ > > ????????????????????????????? [1,$c->loc('request')], > > ????????????????????????????? [2,$c->loc('booking')] > > ????????????????????????????? ]); > > > > This is working, but is there a better solution?? > > > > But this method istn?t working if I have multiple radio buttons: > > ??? #Breakfast > > ??? - type: Radio > > ????? name: breakfast > > ????? label_loc: breakfast > > ??? - type: Radio > > ????? name: breakfast > > > > These two buttons have the same name because they should be a group (Know > already about Radiogroup, but Radiogroup has the strange Border and Title). > > How can I set the values on these two radio buttons? > > $form->get_all_elements({name => 'breakfast'}) is always returning an empty > array. > > I want to set one to Yes and the other to No (localized). As Octavian mentioned, there is a value_loc() variant of value(), so if you're using Radio fields, just try using that. For RadioGroup, its options() method does support "value_loc" keys in hash-ref option definitions. Carl From orasnita at gmail.com Tue Sep 13 19:35:14 2011 From: orasnita at gmail.com (Octavian Rasnita) Date: Tue Sep 13 19:47:13 2011 Subject: [html-formfu] Localize value References: <000001cc7201$b372ca00$1a585e00$@s.profanter.me> <000f01cc7211$c0a23c50$41e6b4f0$@s.profanter.me> Message-ID: <08E5B6D3C9554AABB0D8B46DCDD864D5@teddy> OK, then if the keys are actually 1, 2, 3 and so on, they don't need to be localized. As usually, they are probably keys in a db table. The only thing you need to localize are the labels "Yes" or "No" that will be printed on the page, and you can do that with the code you sent to the list. Octavian ----- Original Message ----- From: "Stefan" To: "'HTML Form Creation, Rendering and Validation Framework'" Sent: Tuesday, September 13, 2011 3:36 PM Subject: AW: [html-formfu] Localize value > Hi Octavian, > > > >>I don't know if there is a value_loc option for select/radio elements > because I never needed such a thing, but if there is not, you can get the > localized value after submitting the form and in the form print just the key > you want to localize (because the users can't see that key anyway). > > > > Sorry, I miswrote it a little bit. The value_loc exists for eg the submit > button. But if I want to localize an options array I have to do it by the > long way mentioned in the post before. It seems that there is no options_loc > (Post from 2007: > http://lists.scsys.co.uk/pipermail/html-formfu/2007-October/000640.html). > I need the localization with options to generate localized html code like > the following: > > > > > > And > > # Request type > > - type: Select > > name: type > > label_loc: type > > options: > > - value: '1' > > label_loc: request > > - value: '2' > > label_loc: booking > > > > is doing this job. > > > > Thanks anyway for your response! > > Stefan > > -------------------------------------------------------------------------------- > _______________________________________________ > HTML-FormFu mailing list > HTML-FormFu@lists.scsys.co.uk > http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu From jbl at jbldata.com Thu Sep 22 20:10:15 2011 From: jbl at jbldata.com (J. Bobby Lopez) Date: Thu Sep 22 20:10:20 2011 Subject: [html-formfu] Pre-populating a form (no submit yet) Message-ID: Hello, I'm trying to figure out how to pre-populate a formfu form with data I have in a %hash. The keys in the hash match the names of form elements (if that's helpful at all). The problem I'm running into is understanding how $form->process() works if nothing has been submitted. If there has been no form submission (and therefore no $query_object), how can I get formfu to populate fields with existing data from my %hash? Reviewing formfu docs didn't provide any insight on this (or I missed it). Can anyone shed some light on this? Thanks, -Bobby From jbl at jbldata.com Thu Sep 22 20:31:58 2011 From: jbl at jbldata.com (J. Bobby Lopez) Date: Thu Sep 22 20:32:04 2011 Subject: [html-formfu] Re: Pre-populating a form (no submit yet) In-Reply-To: References: Message-ID: Searching for 'populate' didn't get me where I wanted to go, but.. Huzzah.. found it.. $form->default_values( $hash_ref ) On Thu, Sep 22, 2011 at 4:10 PM, J. Bobby Lopez wrote: > Hello, > > I'm trying to figure out how to pre-populate a formfu form with data I > have in a %hash. ?The keys in the hash match the names of form > elements (if that's helpful at all). > > The problem I'm running into is understanding how $form->process() > works if nothing has been submitted. ?If there has been no form > submission (and therefore no $query_object), how can I get formfu to > populate fields with existing data from my %hash? > > Reviewing formfu docs didn't provide any insight on this (or I missed > it). ?Can anyone shed some light on this? > > Thanks, > -Bobby > From rippls at woodlandschools.org Thu Sep 22 20:40:32 2011 From: rippls at woodlandschools.org (Rippl, Steve) Date: Thu Sep 22 20:40:36 2011 Subject: [html-formfu] Pre-populating a form (no submit yet) In-Reply-To: References: Message-ID: On Thu, Sep 22, 2011 at 1:10 PM, J. Bobby Lopez wrote: > > Hello, > > I'm trying to figure out how to pre-populate a formfu form with data I > have in a %hash. The keys in the hash match the names of form > elements (if that's helpful at all). > > The problem I'm running into is understanding how $form->process() > works if nothing has been submitted. If there has been no form > submission (and therefore no $query_object), how can I get formfu to > populate fields with existing data from my %hash? > > Reviewing formfu docs didn't provide any insight on this (or I missed > it). Can anyone shed some light on this? > > Thanks, > -Bobby > > _______________________________________________ > HTML-FormFu mailing list > HTML-FormFu@lists.scsys.co.uk > http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu > Untested code, but something like... while ( my ($name, $value) =3D each %hash_of_data ) { $form->get_element({name =3D> $name})->value($value); } -- = Steve Rippl Technology Director Woodland Public Schools 360 841 2730 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110922/80= 22d428/attachment.htm From perl at rainboxx.de Thu Sep 29 14:43:15 2011 From: perl at rainboxx.de (Matthias Dietrich) Date: Thu Sep 29 14:43:18 2011 Subject: [html-formfu] Found leak in HTML::FormFu::Localize Message-ID: <911197F0-6273-4FC6-8EE6-B68F5F09306B@rainboxx.de> Hi, I went through my Catalyst app with CatalystX::LeakChecker to find possible leaks. CatalystX::LeakChecker showed a leak within FormFu, the following patch should fix it (tests pass, my app works, CatalystX::LeakChecker is happy too). I'd be happy to push it directly into the FormFu master on github, if no one votes against it. Matthias diff --git a/lib/HTML/FormFu/Localize.pm b/lib/HTML/FormFu/Localize.pm index 5a7f398..8b46e01 100644 --- a/lib/HTML/FormFu/Localize.pm +++ b/lib/HTML/FormFu/Localize.pm @@ -5,7 +5,7 @@ use strict; use HTML::FormFu::Util qw( require_class ); use List::MoreUtils qw( any ); use List::MoreUtils qw( pairwise ); -use Scalar::Util qw( blessed ); +use Scalar::Util qw( weaken blessed ); use Exporter qw( import ); use Carp qw( croak ); @@ -83,6 +83,7 @@ sub add_localize_object { localize_object => $localize_object, dies_on_missing_key => $dies_on_missing_key, }; + weaken @{ $self->{localize_data} }[-1]->{localize_object}; } return $self; -- rainboxx Software Engineering Matthias Dietrich rainboxx Matthias Dietrich | Phone: +49 7141 / 2 39 14 71 K?nigsallee 43 | Fax : +49 3222 / 1 47 63 00 71638 Ludwigsburg | Mobil: +49 151 / 50 60 78 64 | WWW : http://www.rainboxx.de CPAN: http://search.cpan.org/~mdietrich/ XING: https://www.xing.com/profile/Matthias_Dietrich18 GULP: http://www.gulp.de/profil/rainboxx.html From perl at rainboxx.de Thu Sep 29 16:01:22 2011 From: perl at rainboxx.de (Matthias Dietrich) Date: Thu Sep 29 16:01:26 2011 Subject: [html-formfu] Found leak in HTML::FormFu::Localize In-Reply-To: <911197F0-6273-4FC6-8EE6-B68F5F09306B@rainboxx.de> References: <911197F0-6273-4FC6-8EE6-B68F5F09306B@rainboxx.de> Message-ID: <870D9B34-FE0A-4B3C-97FB-53BF18887940@rainboxx.de> Oh wait, tests are not passing anymore. Something went wrong... Ok, so I fixed the test t/i18n/add_localize_object.t so it holds a strong r= eference of the localize_object outside of FormFu. To fix the test t/i18n/add_localize_object_from_class.t I need some wisdom = of the community. I guess when using add_localize_object_from_class, local= ize_object will have no other reference than within localize_data, so weake= n it will destroy it. So I added a key within $self to indicate whether to= weaken the localize_object or not. Basically how the weaken_localize_object key is added and retrieved seems a= bad way to me, but I think I cannot add another parameter to add_localize_= object() because it is used by other modules and would break them. Any tho= ughts about this? Please find a new patch attached to this mail or view the commit a github: = https://github.com/rainboxx/HTML-FormFu/commit/087450dfc463632a22771dc30fac= b75007036f7d Thanks, Matthias -- = rainboxx Software Engineering Matthias Dietrich rainboxx Matthias Dietrich | Phone: +49 7141 / 2 39 14 71 K=F6nigsallee 43 | Fax : +49 3222 / 1 47 63 00 = 71638 Ludwigsburg | Mobil: +49 151 / 50 60 78 64 | WWW : http://www.rainboxx.de CPAN: http://search.cpan.org/~mdietrich/ XING: https://www.xing.com/profile/Matthias_Dietrich18 GULP: http://www.gulp.de/profil/rainboxx.html -------------- next part -------------- Skipped content of type multipart/mixed