Victor Igumnov | 1 Feb 01:37

[FormBuilder] CGI::FormBuilder memory leak fix

This leak was very obvious in a persistent environment that uses CGI::FormBuilder (ie: catalyst). The patch below fixes the circular reference leak.

All tests pass.

http://temp.fabulously40.com/~victori/CGI-FormBuilder-3.05-memfix.tbz


_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers
Victor Igumnov | 3 Feb 00:06

[FormBuilder] Ok I got a proper memory leak fix now, without cloning.


Please release a new version soon since my project depends on it.

-Victor


On Jan 31, 2007, at 4:37 PM, Victor Igumnov wrote:

This leak was very obvious in a persistent environment that uses CGI::FormBuilder (ie: catalyst). The patch below fixes the circular reference leak.

All tests pass.

http://temp.fabulously40.com/~victori/CGI-FormBuilder-3.05-memfix.tbz


_______________________________________________
FBusers mailing list

_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers
José Parrella | 3 Feb 20:15
Picon
Gravatar

[FormBuilder] <tr> HTML attributes

When using CGI::FB in a standard way to build a form, I was interested
in the jsclick option in order to provide a quick effect from
Scriptaculous in my forms: if a radio button was clicked, some rows
needed to appear.

This requires me to set an id="" attribute in the desired <tr>'s (which
CGI::FB already does: FormName_FieldName_label) but also to set inline
display: none; style attributes in order to "hide" the rows when the
form loads.

I can't specify them through CSS because of a del.icio.us feature, but I
didn't see an option to specify <tr> attributes (just <td>). I patched
CGI::FB in order to have this done, but I could also have used a
particular template, of course. Is there any other way to achieve this
which is currently available in FB? Would it be useful if we could
specify <tr> attributes through CGI::FB?

Thanks a lot,
Jose

--

-- 
José M. Parrella -> Debian Sid, k2.6.18
Escuela de Ingenieria Electrica
Universidad Central de Venezuela -> ucvlug.info
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers
José Parrella | 3 Feb 20:16
Picon
Gravatar

[FormBuilder] Multipage forms in Catalyst

Greetings,

I've been trying to setup a few sites which need to implement multipage
forms, under Catalyst. I've read the tutorial in formbuilder.org
regarding multipage forms, and I've tried two different ways for this:

1) Setting up the first page is easy with C::Plugin::FB, and the
YAML-based source files. Therefore I use a single Local Form method in
Catalyst, and the form posts to itself. My whole method is a:

if ($c->form->submitted && $c->form->validate) {
     ... actions
}

Since I'm taking profit of the fact that using TT2, the template name is
setup by default to /root/≤path>.tt2. When the user is entering the
first page, $c->form isn't submitted nor validated, and it opens the
default template, which has a single form.render and "calls" the .fb
file to get the form configuration. Nice.

Of course, when a user enters some information and submits the form, I
get into my if statement (the form is submitted and validates), and I
can do all my DB stuff, etc. But if I want a second form to show up, I
can't set a particular .fb source file (so I can't set my second form
configuration), and the $c->form object is already filled with previous
information.

Using state parameters (such as "add", "show", etc.), doesn't help me
since I still can't call a particular source file.

2) If I set the submit action to another path, then $c->form moves
there, too. It also happens if I do something like
$c->forward(/another/path). Then I get strange behaviors such as fields
of the first form appearing in the second form, or fields getting the
values from the last form (maybe sticky = 0 will help?)

I truly think this (number 2) is the right way to work, but maybe I'm
missing something. I would really like to know what are you using and
which are your recommended best practices regarding multipage forms with
CGI::FB in Catalyst. I've already reduced hundreds of SLOCs based in CGI
and DBI to only tenths of clean code in Catalyst, but this has become a
show stopper, at least for me.

Thanks for your time and comments,
Jose

--

-- 
José M. Parrella -> Debian Sid, k2.6.18
Escuela de Ingenieria Electrica
Universidad Central de Venezuela -> ucvlug.info
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers
Mike Scoltock | 4 Feb 13:29
Picon

[FormBuilder] FormBuilder and Data::FormValidator

Hi all,

I've been using FormBuilder and Data::FormValidator together, but have run into
a few fairly minor problems.

1. Unless you remember to put a field in "optional" list in the
Data::FormValidator profile, it won't be checked or filtered or anything. This
logic is slightly different to FormBuilder's, where there isn't really a
difference between optional and "not required".

2. A Data::FormValidator constraint which isn't specific to just one field (for
example, a 'require_some') causes FormBuilder to create a new fictitous text
field with the name of the contraint and with the constraint's error message.
The error ought to be reported at the level of the form, rather as an error on
any one field. This I managed to correct just by using some css to hide the
field leaving the message.

3. These modules don't seem to work correctly together for fields with options
and other=>1. Instead of returning the value of the "other" text field, it
returns the name of the field.

Other than these minor and avoidable problems though, a great job combining
these two modules. For example, I've now got date entries being thoroughly
checked in almost any format with just a few lines of code.

_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers

Dan Axtell | 4 Feb 21:33

[FormBuilder] Dynamic fields and templates

Hi,

I'm tying to build a form where most of the fields are standard fields, laid 
out via a template, but with a section where some fields may or may not be 
added dynamically, depending on the record type I'm editing.

The idea was that at run time I'd do something like:

my $tmpl = HTML::Template->new( ...)
$tmpl->param('form-start'  => "<tmpl_var form-start>"); 
$tmpl->param('form-submit' => "<tmpl_var form-submit>");
# all standard field template tags get replaced by themselves
# for FormBuilder to expand ...

$tmpl->param('dynamic-controls' => \@list_of_extra_fields);

# Now create the form object
my $form->CGI::FormBuilder->new( 
  fields =>\@list_of_all_fields,
  template => $tmpl,
   ....
);

This fails because $tmpl is an HTML::Template object and doesn't have a 
render() method.

Is subclassing CGI::FormBuilder::Template::HTML the only way to get something 
like this to work?   It seems odd that the template attribute can be an 
object reference but NOT an HTML::Template reference.
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers

Nate Wiger | 5 Feb 18:38
Picon
Gravatar

Re: [FormBuilder] Ok I got a proper memory leak fix now, without cloning.

Victor-

Thanks for the patch. I've patched this into the tree available via svn:

   svn co http://www.formbuilder.org/repos/formbuilder/trunk

Some of the tests are failing (from an unrelated change) so I can't
upload it to CPAN yet. Please svn co it and see how it works. I will
work on getting it to CPAN in the new day or two.

-Nate

On 2/2/07, Victor Igumnov <victori <at> lamer0.com> wrote:
>
> http://temp.fabulously40.com/~victori/fb-memfix.patch
>
> Please release a new version soon since my project depends on it.
>
> -Victor
>
>
>
> On Jan 31, 2007, at 4:37 PM, Victor Igumnov wrote:
> This leak was very obvious in a persistent environment that uses
> CGI::FormBuilder (ie: catalyst). The patch below fixes the circular
> reference leak.
>
> All tests pass.
>
> http://temp.fabulously40.com/~victori/CGI-FormBuilder-3.05-memfix.tbz
>
>
> _______________________________________________
> FBusers mailing list
> FBusers <at> formbuilder.org
> http://www.formbuilder.org/mailman/listinfo/fbusers
>
> _______________________________________________
> FBusers mailing list
> FBusers <at> formbuilder.org
> http://www.formbuilder.org/mailman/listinfo/fbusers
>
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers

Hornet | 5 Feb 23:44
Picon

[FormBuilder] Default Values.

Hello All,

Just want to start out by saying, this is a really great API and easy
to use. Which must be my problem. Below is the code I'm working with.
The problem I'm having is that I can't get the radio button or
checkbox to be either on or off. The $notact with either be 1 or 0,
yet nothing is checked. I thought I was doing what the documentation
was telling me. Can anyone see what I'm doing wrong?

sub edituser {
	&noauth if !&admin;
	&phead;
	my $stmt="select Users.Username, Users.Password, Users.BmsCustId,
Users.Email, Users.FullName, Users.NotActive, Groups.Group as fGroup
		from Users
	        left join Groups on Groups.pkey = Users.Group
		where Users.pkey=$input{edituser}";

	my $h=$dbh->selectrow_hashref($stmt);
	print dumper_html($h);
	my $notact=$h->{NotActive};
	delete $h->{NotActive};
	
	my $group=$dbh->selectall_arrayref("select Groups.Group from Groups");

	$form = CGI::FormBuilder->new(
			fields =>$h,
			smartness => 2,
	);
	$form->field(name=>'NotActive', value=> $notact, options=>"Deactivate
account");
#	print $q->checkbox(-name=>'NotActive', -checked=>$notact,
-label=>'Deactivate acccount'),
	print $form->render;
	
	&leave;
}

--

-- 

-Erik-
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers

Nate Wiger | 6 Feb 18:11
Picon
Gravatar

Re: [FormBuilder] Default Values.

On 2/5/07, Hornet <hornetmadness <at> gmail.com> wrote:
> Hello All,
>
>         my $notact=$h->{NotActive};
>         delete $h->{NotActive};
>
>         $form->field(name=>'NotActive', value=> $notact, options=>"Deactivate
> account");

Your options have to contain your value. For example:

   $notact = 1;   # inactive
   $form->field(name => 'notact', label => 'Not Active', value => $notact,
                     options => [[1, 'Deactivate account']])

Or, if instead you wanted a radio group:

   $form->field(name => 'notact', label => 'Activate Account?', value
=> $notact,
                     options => [[1, 'Yes'], [0, 'No']])

Either of these alternatives will display the 'Text' shown, but return
the value (ie, 1 or 0) to your script.

-Nate
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers

Nate Wiger | 6 Feb 18:15
Picon
Gravatar

Re: [FormBuilder] Multipage forms in Catalyst

Jose-

You should check out the Catalyst FormBuilder Controller, instead of
the plugin. The plugin I wrote had some issues, and I believe this is
one of them. Try the Controller base class (which is maintained by the
Catalyst core team) and see if that solves it.

Cheers,
Nate
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers


Gmane