[jifty-devel] passing in args to page regions which include forms
Matthew Lenz
matthew at nocturnal.org
Sat Jul 7 00:19:14 EDT 2007
On Fri, 2007-07-06 at 15:23 -0400, Nelson Elhage wrote:
> On Fri, Jul 06, 2007 at 12:09:16PM -0500, Matthew Lenz wrote:
> > <%args>
> > $parent
> > </%args>
> > <%init>
> > my $action = Jifty->web->new_action( class => 'CreateChild' );
> > </%init>
> > <h2>Add Issue</h2>
> > <% Jifty->web->form->start() %>
> > <% $action->form_field('someCclmn1') %>
> > <% $action->form_field('someCclmn2') %>
> > <% Jifty->web->form->submit( label => 'Submit' ) %>
> > <% Jifty->web->form->end() %>
> >
> > (I didn't include my experimentations in the code above)
> >
> > I've tried setting argument values on the $action .. setting parent =>
> > $parent also tried parent_id => $parent. I've tried different
> > combinations where the fragment will load but as soon as you submit it
> > complains that the required $parent arg is missing and other
> > combinations where it complains about the $parent args missing
> > immediately even though its being passed into the fragment just like the
> > other fragments called from the template.
> >
> > I'm sure its something stupid and simple but I can't find any examples
> > of this stuff that don't use the dispatcher for everything.
> >
> > What am I overlooking?
>
> Actions don't store any persistent state between requests; They only
> have the information that is explicitly serialized into the HTML. Thus,
> you need to create a hidden field containing the parent parameter to the
> action, so that when the action is submitted, it will pick up the
> parameter from there. You can do this with:
>
> <% $action->hidden(parent => $parents) %>
This works partially but dies upon upon submit. reloading the server
shows that the data was added to the db properly though. Here is the
error:
FATAL - view class error: no value sent for required parameter 'parent'
Stack:
[/usr/local/share/perl/5.8.8/auto/Jifty/web/templates/autohandler:10]
FATAL - view class error: ABORT
at /usr/local/share/perl/5.8.8/Jifty/Dispatcher.pm line 748.
> Or by passing parent => $parents to the new_action call, and then just
>
> <% $action->hidden('parent') %>
>
> That should do what you want,
>
> - Nelson
tried that as well passing arguments => { parent => $parent } to the
new_action and it failed with the same error.
> >
> > _______________________________________________
> > jifty-devel mailing list
> > jifty-devel at lists.jifty.org
> > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
More information about the jifty-devel
mailing list