Re: [Catalyst] problem with FormBuilder + TT2

2006-09-21 Thread Moritz Sisenop
Thank you guys for your help.Somehow it works now, though I don't know why.All I have now is my Formbuilder source fileand $c-stash-{template} = 'customers/signup.tt2'; in the controller.
I am quite sure that I had the same setup during my experimentation, but I don't know why it works now.Once again, thank you all for your help.Regards, Moritz
On 9/19/06, Jason Kohles [EMAIL PROTECTED] wrote:
On Sep 19, 2006, at 1:37 AM, Moritz Sisenop wrote:When I try$c-path_to(qw/root customers signup.tt2/)there is no Catalyst error message anymore. 
Just a TT one: Not a GLOB reference at /usr/local/lib/perl/5.8.7/Template/Provider.pm line 647. Template Toolkit doesn't know what to do with the Path::Class::File object that path_to is going to return,
use $c-path_to(qw/root customer signup.tt2/)-stringify instead.--
Jason Kohles[EMAIL PROTECTED]
http://www.jasonkohles.com/A witty saying proves nothing. -- Voltaire___List: 
Catalyst@lists.rawmode.orgListinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] problem with FormBuilder + TT2

2006-09-19 Thread Karl . Moens





John Napiorkowski wrote:

 (snip)

 Hey, question for you; are you using Formbuilder with
 a database?  If so what are you doing to manage
 getting stuff between formbuild and your datbase of
 choice?  I'm using DBIx and just doing braindead stuff
 like writing a bunch of $c-form-field(name=,
 value=) but I figure there's a better way.  I just
 can't seem to get DBIx::Class::FormTools to do what I
 think it can do for me.  Maybe I just need more work
 on it.

I'm using Catalyst::Plugin::FormBuilder and in order to transfer data back
and forth between the forms and the database (accessed with DBIx::Class) I
do something like:

1. Make sure that your form-fields have the same names as your columns
accessors.
2. Give your sub-routines to which Catalyst dispatches your URL's the :
Form attribute.
3a. To add a record:
   codemy ( $self, $c ) = @_;
 if ($c-form-submitted  $c-form-validate) {
my $record=$c-model('Your::table')-create(scalar
$c-form-field());
 }/code
3b. To edit a record:
   codemy ( $self, $c, $key ) = @_;
my $record=$c-model('Your::table')-find($key);
if ($c-form-submitted  $c-form-validate) {
$record-update(scalar $c-form-field());
}
else {
map {$c-form-field('name' = $_, 'value' = $record-$_)}
$c-form-field();
}
/code

Easy as pie!


Karl
aka CountZero at Perlmonks



~~~
This message and any attachments are confidential. If you have received
this message in error please delete it from your system. If you require any
assistance please notify the sender. Thank You.
~~~


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] problem with FormBuilder + TT2

2006-09-19 Thread Jason Kohles
On Sep 19, 2006, at 1:37 AM, Moritz Sisenop wrote:When I try$c-path_to(qw/root customers signup.tt2/)there is no Catalyst error message anymore. Just a TT one: "Not a GLOB reference at /usr/local/lib/perl/5.8.7/Template/Provider.pm line 647." Template Toolkit doesn't know what to do with the Path::Class::File object that path_to is going to return,use $c-path_to(qw/root customer signup.tt2/)-stringify instead.--  Jason Kohles[EMAIL PROTECTED]http://www.jasonkohles.com/"A witty saying proves nothing."  -- Voltaire ___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] problem with FormBuilder + TT2

2006-09-18 Thread Ash Berlin
Moritz Sisenop wrote:
 Hello!
 I am using FormBuilder, CGI::FormBuilder::Source::File, and TT2.
 I set the template in the source file:

 template:
 type: TT2
 template: customers/signup.tt2

 And get the following error:

 undef error - Fatal: file error - customers/signup.tt2: not found at 
 /usr/local/share/perl/5.8.7/CGI/FormBuilder/Util.pm line 149 
 CGI::FormBuilder::Util::puke('Template::Exception=ARRAY(0x94b5b90)') 
 called at /usr/local/share/perl/5.8.7/CGI/FormBuilder/Template/TT2.pm 
 line 66

 Might it be that FormBuilder doesn't find the Catalyst template dir, 
 and if yes, how do I let FB know?
 Any help is greatly appreciated.

 Best regards,

 Moritz
 

 ___
 List: Catalyst@lists.rawmode.org
 Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
 Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
 Dev site: http://dev.catalyst.perl.org/
   
What i think you want is $c-path_to(qw/root customers signup.tt2/)

Ash




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] problem with FormBuilder + TT2

2006-09-18 Thread John Napiorkowski
-- Ash Berlin [EMAIL PROTECTED] wrote:

 Moritz Sisenop wrote:
  Hello!
  I am using FormBuilder,
 CGI::FormBuilder::Source::File, and TT2.
  I set the template in the source file:
 
  template:
  type: TT2
  template: customers/signup.tt2
 
  And get the following error:
 
  undef error - Fatal: file error -
 customers/signup.tt2: not found at 
 
 /usr/local/share/perl/5.8.7/CGI/FormBuilder/Util.pm
 line 149 
 

CGI::FormBuilder::Util::puke('Template::Exception=ARRAY(0x94b5b90)')
 
  called at

/usr/local/share/perl/5.8.7/CGI/FormBuilder/Template/TT2.pm
 
  line 66
 
  Might it be that FormBuilder doesn't find the
 Catalyst template dir, 
  and if yes, how do I let FB know?
  Any help is greatly appreciated.
 
  Best regards,
 
  Moritz

I had a similar trouble when I just started to use
formbuilder.  Here's what I did:

First, I put some global config stuff into my catalyst
myapp.yml file:

##
## Formbuilding options
##
form:
  method: post
  form_path: __path_to(root)__

the 'form_path' option I set so that by default my
*.fb files end up in the same location as my template
toolkit files.

Then I find that if I am using a reasonably standard
setup for TT my actions automatically find the *.fb
and *.tt files for me.

that '__path)to...__' biz is something that the
ConfigLoader plugin translates for you, I am doubtful
it will work in your standard *.fb file.

Hey, question for you; are you using Formbuilder with
a database?  If so what are you doing to manage
getting stuff between formbuild and your datbase of
choice?  I'm using DBIx and just doing braindead stuff
like writing a bunch of $c-form-field(name=,
value=) but I figure there's a better way.  I just
can't seem to get DBIx::Class::FormTools to do what I
think it can do for me.  Maybe I just need more work
on it.

--john

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] problem with FormBuilder + TT2

2006-09-18 Thread Moritz Sisenop
When I try$c-path_to(qw/root customers signup.tt2/)there is no Catalyst error message anymore. Just a TT one: Not a GLOB reference at /usr/local/lib/perl/5.8.7/Template/Provider.pm line 647.
I didn't trywhatJohnrecommendedsinceIwanttokeepmyformdescriptionsandtt-templatesindifferentdirs. Instead tried template: 	type: TT2	template: __path_to(root src customers signup.tt2
)__	engine: 		include_path: __path_to(root src)__		INTERPOLATE: 1		ABSOLUTE: 1but that didn't work.John, I am can't even worry about the DB stuff right now ;)Roy, sorry I meant to write I am using Catalyst::Plugin::FormBuilder
Regards,Moritz
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/