Steve Schwarz | 2 Oct 04:31
Picon

[FormBuilder] Newbie Redirect Question

Hi
I'm just learning to use FormBuilder and the order.cgi example in the perldoc shows to do a redirect as follows:
 
    # Check for valid order
    if ($form-> submitted eq 'Cancel') {
        # redirect them to the homepage
        print $form->cgi->redirect ('/');
        exit;
    }
 
But $form->cgi doesn't seem to be valid:
[Sun Oct 01 21:14:05 2006] [error] [client 127.0.0.1] [FormBuilder] Warning: Possible field access via $form->cgi() - see 'fieldsubs' option
[Sun Oct 01 21:14:05 2006] [error] [client 127.0.0.1] Can't call method "redirect" on an undefined value
 
Any assistance would be appreciated.
Steve
 
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers
Jeff Boes | 2 Oct 15:29
Favicon
Gravatar

Re: [FormBuilder] HTML::Template with FormBuilder

Nate Wiger wrote:
>
> Jeff, HTML::Template is already natively supported. You don't need to
> create that sub at all. Change your template type to just 'HTML'.
> Check out the walkthrough for an example of HTML template usage:
>
>
http://www.formbuilder.org/download/CGI-FormBuilder-3.0401/docs/CGI/FormBuilder.html#walkthrough 
>

Thanks, but I'm still confused. This returns an error:

  my $fb =  CGI::FormBuilder->new( ... );
  $fb->engine->param( results => \@results );

How do I set other parameters within the template if I don't have a 
template object?

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

Xavier Robin | 2 Oct 15:54
Picon
Picon
Favicon

[FormBuilder] Accessing 'text' option and messages from Template Toolkit

Hello,

I'm trying to figure out how to access in TemplateToolkit to some of the 
options defined at the creation of the CGI::FormBuilder object.

my $form = CGI::FormBuilder->new(
	title => 'Form title',
	template => {
		type => 'TT2',
		template => template.tmpl',
		variable => 'form'
	},
	text => 'Some text here.',
	messages => { the_message => 'The message comes here.'},
	...
}

In my template (TemplateToolkit), I can access to the title using 
[% form.title %]. But [% form.text %] doesn't give me the text "Some text 
here".
Is it possible to get it ? How ?
Same thing for the messages (especially form_invalid_text, js_noscript, etc.)

All these options are correctly set and work well without template. It's just 
I don't know how to get them within a TemplateToolkit template.

I would really appreciate any clue.

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

Jeff Boes | 2 Oct 16:03
Favicon
Gravatar

Re: [FormBuilder] HTML::Template with FormBuilder

Jeff Boes wrote:
> Thanks, but I'm still confused. This returns an error:
>
>   my $fb =  CGI::FormBuilder->new( ... );
>   $fb->engine->param( results => \@results );
>
> How do I set other parameters within the template if I don't have a 
> template object?
>   
I should be more specific: this results in the error:

Can't call method "param" on an undefined value
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers

Kurt Lidl | 2 Oct 17:26
Favicon

Re: [FormBuilder] HTML::Template with FormBuilder

Jeff Boes wrote:
> Jeff Boes wrote:
>   
>> Thanks, but I'm still confused. This returns an error:
>>
>>   my $fb =  CGI::FormBuilder->new( ... );
>>   $fb->engine->param( results => \@results );
>>
>> How do I set other parameters within the template if I don't have a 
>> template object?
>>   
>>     
> I should be more specific: this results in the error:
>
> Can't call method "param" on an undefined value
>   
For HTML::Template, you just do it like this:

$fb->tmpl_param(name => $name);
$fb->tmpl_param(other => $some_other_field);

-Kurt

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

Jeff Boes | 2 Oct 17:38
Favicon
Gravatar

Re: [FormBuilder] HTML::Template with FormBuilder

Kurt Lidl wrote:
> Jeff Boes wrote:
>>
>> Can't call method "param" on an undefined value
>>   
> For HTML::Template, you just do it like this:
>
> $fb->tmpl_param(name => $name);
> $fb->tmpl_param(other => $some_other_field);
Ah! Thanks, that's it. I can't explain why I could read the docs page 
three times and miss tmpl_param. Even after searching the page for 
"param" ...

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

Nate Wiger | 3 Oct 00:53
Picon
Gravatar

Re: [FormBuilder] Newbie Redirect Question

On 10/1/06, Steve Schwarz <agilitynerd <at> gmail.com> wrote:
> Hi
> I'm just learning to use FormBuilder and the order.cgi example in the
> perldoc shows to do a redirect as follows:
>
>     # Check for valid order
>     if ($form-> submitted eq 'Cancel') {
>         # redirect them to the homepage
>          print $form->cgi->redirect ('/');
>         exit;
>     }

That's a documentation error. You should instead use your own CGI object:

   my $cgi = new CGI;
   my $form = FB->new(..., params => $cgi);
   # ...
   print $cgi->redirect('/');

I'll make sure that gets corrected.

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

Robert Dobbs | 4 Oct 00:00
Picon

Re: [FormBuilder] Accessing 'text' option and messages from TemplateToolkit

Do this instead:

>my $form = CGI::FormBuilder->new(
>	title => 'Form title',
>	template => {
>		type => 'TT2',
>		template => template.tmpl',
>		variable => 'form',
                 data => { text => 'Some text here.', },
>	},
>	messages => { the_message => 'The message comes here.'},
>	...
>}

Then refer to 'text' in your template.

Mark

_________________________________________________________________
Add fun gadgets and colorful themes to express yourself on Windows Live 
Spaces   
http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://www.get.live.com/spaces/features

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

Robert Dobbs | 4 Oct 00:06
Picon

Re: [FormBuilder] Accessing 'text' option and messages from TemplateToolkit

Oh duh.

Looks like TT2.pm needs this:

--- /tmp/TT2.pm 2006-10-03 15:05:41.000000000 -0700
+++ /usr/local/share/perl/5.8.8/CGI/FormBuilder/Template/TT2.pm 2006-10-03 
15:06:19.000000000 -0700
@@ -75,6 +75,7 @@
     # must generate JS first because it affects the others
     $tmplvar{'jshead'} = $form->script;
     $tmplvar{'title'}  = $form->title;
+    $tmplvar{'text'}   = $form->text;
     $tmplvar{'start'}  = $form->start . $form->statetags . 
$form->keepextras;
     $tmplvar{'submit'} = $form->submit;
     $tmplvar{'reset'}  = $form->reset;

Mark

>From: Xavier Robin <robin0 <at> etu.unige.ch>
>To: FBusers <at> formbuilder.org
>Subject: [FormBuilder] Accessing 'text' option and messages from 
>TemplateToolkit
>Date: Mon, 02 Oct 2006 15:54:24 +0200
>
>Hello,
>
>I'm trying to figure out how to access in TemplateToolkit to some of the
>options defined at the creation of the CGI::FormBuilder object.
>
>
>my $form = CGI::FormBuilder->new(
>	title => 'Form title',
>	template => {
>		type => 'TT2',
>		template => template.tmpl',
>		variable => 'form'
>	},
>	text => 'Some text here.',
>	messages => { the_message => 'The message comes here.'},
>	...
>}
>
>In my template (TemplateToolkit), I can access to the title using
>[% form.title %]. But [% form.text %] doesn't give me the text "Some text
>here".
>Is it possible to get it ? How ?
>Same thing for the messages (especially form_invalid_text, js_noscript, 
>etc.)
>
>All these options are correctly set and work well without template. It's 
>just
>I don't know how to get them within a TemplateToolkit template.
>
>I would really appreciate any clue.
>
>Greetings,
>Xavier Robin
>_______________________________________________
>FBusers mailing list
>FBusers <at> formbuilder.org
>http://www.formbuilder.org/mailman/listinfo/fbusers

_________________________________________________________________
Express yourself - download free Windows Live Messenger themes! 
http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?href=http://imagine-msn.com/themes/vibe/default.aspx?locale=en-us&source=hmtagline

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

W.P.Nijhof | 4 Oct 22:38
Picon

[FormBuilder] Dutch messages for FormBuilder

Hi,

I made a messages file with Dutch translations, but I've got a question: 
should it be named "nl.pm", "nl_NL.pm" or both?

It's unclear to me why there are duplicate message files (de.pm, 
de_DE.pm etc.)

WayPay

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


Gmane