[jifty-devel] Passing variables back from ajax components

bart bunting bart at bunting.net.au
Fri Mar 24 05:50:22 EST 2006


Hi all,

I'm a little stuck.  

I've copied the code from the Jifty admin interface to use it for
editing records in my application.  This on the whole is working fine.
I am having trouble with a small bit of it.  

I've customised it so that there is a mason variable indicating which
Category you are currently editing.  This is all working fine until
you hit submit.  I've passed the CategoryId down through the
components but for example with the new_categoryMember fragment when
you hit submit the CategoryId is lost.  As a result a page showing
members from all categories is shown.

I paste below my new_categoryMember fragment.  I am sure it has the
correct CategoryId when it is called but am confused as to how I am
meant to pass this back up so when the submit is hit the page is
redrawn showing only things in that category.

Perhaps I've just got no idea about how to do this, I've tried several
ways but none seem to work.

Cheers

Bart
 

<%args>
$region
$category => undef
</%args>


<%init>
 my $create = Jifty->web->new_action(class => 'CreateProductCategory');
 $create->form_field('category', render_as => 'hidden', default_value => $category); 
</%init>

<div class="create item inline">
% foreach my $argument (qw (product category priority)) {
        <%$create->form_field($argument)%>
%}

<br>
category is <% $category %>
</div>
<%


Jifty->web->form->submit(
    label    => 'Create',
    onclick  => [
                 { submit => $create },
                 { refresh_self => 1 },
                 {
                   element => $region->parent->get_element('dl.list'),
                   append => '/admin/fragments/categoryMembers/view',
                   args   => { 
                              id          => { result_of => $create, name => 'id' },
                             },
                 },
                ]
    ) %>
</div>


More information about the jifty-devel mailing list