Gossamer Forum
Quote Reply
Add_Success Hook
Hi,
I'm trying to set up a (pre) add_success hook but it is not getting called. I've set up other hooks without problems but for some reason this one doesn't work. Is add_success a valid hook? Has anyone had any problems with this?
Thank you.
Simon.
Quote Reply
Re: [jai] Add_Success Hook In reply to
GT any ideas??????
Quote Reply
Re: [jai] Add_Success Hook In reply to
I guess the only way to get help with DBManSQL these days is to email GT support, which is disappointing because other users don't benifit from the results (unless we post them later).
This forum is not very active these days compared to other GT product forums. I think DBManSQL is a great product but obviously not as popular as LinksSQL, etc.
Simon.
Quote Reply
Re: [jai] Add_Success Hook In reply to
Sorry about the late reply.

The add_success is not a hook. But you can set it up like

sub add_record {
#----------------------------------------------------------------------
my ($home) = @_;
.......

if ( defined (my $ret = $home->{db}->add($home->{cgi})) ) {
$home->auth_logging('add record ') if ( $home->{cfg}->{log_file} );
add_success($home, $ret);
}
else {
local $^W;
my $error = $GT::SQL::error;
$error =~ s/\n/<br>\n<li>/g;
add_form($home, "<font color=red><ul><li>$error</ul></font>");
}
...
}

sub add_success {
DO SOMETHING HERE
}

add_record is a pre hook.

Hope that helps.

TheStone.

B.
Quote Reply
Re: [TheStone] Add_Success Hook In reply to
Thanks, that should get me around my current problem but I would appreciate it if you could explain why "add_success" is not a valid hook. In a previous post (http://gossamer-threads.com/...;;page=unread#223431) you said that the hooks use the format -
$COMPILE{subroutine_name} = <<'END_OF_SUB';
sub subroutine_name {
....
}
END_OF_SUB

If that is the case then "add_success" should be a valid hook or am I missing something?

Could you please post a list of valid hooks (as my list in the above mentioned post is obviously NOT correct).
Thank you.
Simon.
Quote Reply
Re: [jai] Add_Success Hook In reply to
The thing is that add_success will only be called after adding a record, so you cannot use it like: db.cgi?db=table;do=add_success.

The list of valid hooks is below:

signup_form
signup
login_form
login
log_off
add_form
add_record
add_multi_form
add_multi_records
modify_search_form
modify_search_results
modify_form
modify_record
modify_multi_results
modify_multi_records
delete_search_form
delete_search_results
delete_records
search_form
search_results
admin_form
admin_edit_user
admin_delete_user
view_file
download_file
qsearch_form
qsearch_results


TheStone.

B.

Last edited by:

TheStone: Mar 19, 2004, 4:35 PM