Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Auto add value

Quote Reply
Auto add value
Does anyone know if there's an easy way to automatically add a value from one table column to another table column each time a record is added to the second table? I know it can be done with a hidden input tag in the HTML, but is there another way to accomplish the same thing by using a global or editing the add_record sub in Home.pm?

I'm concerned about the security of the transfer of this value, so I don't want to use hidden inputs because users could edit them in the browser's URL field. Any ideas?
Quote Reply
Re: [Halito] Auto add value In reply to
The answer is...

Create a new global:

sub {
my $tags = shift;
my $id = $tags->{table1column};
my $table = $DB->table('table2');
$table->update ( { table2column => $id } );
}


Then you refer to this global somewhere in the add_success template. At least this worked for me!