Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [timbo] adding records - two select fields, one updates the other?

Quote Reply
Re: [timbo] adding records - two select fields, one updates the other? In reply to
Just simple create a global template like:

sub {
my ($select_name, $cat_id) = @_;
my $tags = GT::Template->tags;

my $results = $DB->table('Product_Category')->select({ category_code => $cat_id }, ['product_code', 'product_name'])->fetchall_hashref;

my (@values, @names);
foreach (@$results) {
push @values, $_->{product_code};
push @names, $_->{product_name};
}

return $tags->{home}->{disp}->select ( {
name => $select_name,
values => \@values,
names => \@names,
value => $tags->{$select_name},
blank => 1,
});
}

Now you can use <%global_name('select_name', category_code)%> tag in template.

Hope that helps.

TheStone.

B.
Subject Author Views Date
Thread adding records - two select fields, one updates the other? timbo 10648 Nov 18, 2003, 6:41 AM
Thread Re: [timbo] adding records - two select fields, one updates the other?
assombracao 10480 Nov 19, 2003, 3:02 AM
Thread Re: [assombracao] adding records - two select fields, one updates the other?
timbo 10504 Nov 27, 2003, 12:07 PM
Thread Re: [timbo] adding records - two select fields, one updates the other?
604 10432 Nov 27, 2003, 1:30 PM
Thread Re: [TheStone] adding records - two select fields, one updates the other?
timbo 10446 Nov 27, 2003, 10:45 PM
Thread Re: [timbo] adding records - two select fields, one updates the other?
604 10488 Nov 28, 2003, 10:43 AM
Thread Re: [TheStone] adding records - two select fields, one updates the other?
timbo 10462 Nov 29, 2003, 12:47 AM
Thread Re: [timbo] adding records - two select fields, one updates the other?
604 10432 Dec 1, 2003, 10:14 AM
Thread Re: [TheStone] adding records - two select fields, one updates the other?
TIF 9872 Nov 9, 2005, 9:02 PM
Thread Re: [TIF] adding records - two select fields, one updates the other?
604 9876 Nov 10, 2005, 9:45 AM
Thread Re: [TheStone] adding records - two select fields, one updates the other?
TIF 9862 Nov 10, 2005, 9:01 PM
Post Re: [TIF] adding records - two select fields, one updates the other?
TIF 9755 Nov 15, 2005, 5:52 AM
Thread Re: [TIF] adding records - two select fields, one updates the other?
604 9721 Nov 17, 2005, 4:54 PM
Thread Re: [TheStone] adding records - two select fields, one updates the other?
TIF 9678 Nov 21, 2005, 8:49 PM
Thread Re: [TIF] adding records - two select fields, one updates the other?
604 9711 Nov 22, 2005, 12:43 PM
Post Re: [TheStone] adding records - two select fields, one updates the other?
TIF 9776 Nov 25, 2005, 8:58 AM