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

Matthew Lenz matthew at nocturnal.org
Fri Jul 6 13:09:16 EDT 2007


I've got the following situation:


Parent:
   column somePclmn1 ..
   column child refers to Child by parent

Child:
   column someCclmn1 ..
   column someCclmn2 ..
   column parent refers to Parent

So a 1-to-many relationship.

I've created a template: child_list?parent=###

<%args>
$parent
</%args>
<&| /_elements/wrapper, title =>
Jifty->config->framework('ApplicationName') &>
<% Jifty->web->region(
    name => "parent",
    path => "/fragments/parent",
    defaults => { parent => $parent } )
%>
<% Jifty->web->region(
    name => "child-list",
    path => "/fragments/child_list",
    defaults => { parent => $parent } )
%>
<% Jifty->web->region(
    name => "child-add",
    path => "/fragments/child_add",
    defaults => { parent => $parent } )
%>
</&>

the parent and child_list fragments work fine just by adding
<%args>
$parent 
</&args>

at the top and using it to get the Parent model for that record and
limit the ChildCollection to that parent.

the problem is the child_add fragment.  it is a form.  in the admin view
you would choose a parent from a select window when creating a new
Child.  But for the application the parent needs to be taken from the
argument.  Here is the child_add fragment:

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



More information about the jifty-devel mailing list