[jifty-devel] passing in args to page regions which include forms

Nelson Elhage nelhage at bestpractical.com
Fri Jul 6 15:23:49 EDT 2007


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) %>

Or by passing parent => $parents to the new_action call, and then just

<% $action->hidden('parent') %>

That should do what you want,

- Nelson

> 
> _______________________________________________
> 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