Operational hook before update not working as expected

rmassard

New member
Hi,
I have a view called 'cpl_film_match' and a form associated with it. In result view I want a click to edit/update icon to open a form related to the underlying table 'dcp_cpls'.
This code:
$hooks['cpl_film_match']['update']['before'] = 'dadabik_before_match_update';
function dadabik_before_match_update($cpl_id){
header('Location: http://appwebserver/dadabik/index.p...it&where_field=cpl_id&where_value='.$cpl_id);
}
doesn't work.
Neither does the debug code:
function dadabik_before_match_update($params_ar){
print_r($params_ar);
die();
header('Location: http://appwebserver/dadabik/index.p...it&where_field=cpl_id&where_value='.$cpl_id);
}

When does the before update exactly happen ?

Thanks for any help
Raymond
 

eugenio

Administrator
Staff member
Hello,
before you update the record, i.e. after you click "save", the hook is executed and then the record updated. It is not executed when you just open the edit form.

Best,
 

eugenio

Administrator
Staff member
You could use an after/before edit form header layout hook, I haven't tested the redirection here and it's not its intended use but if you just need to redirect to another page, it probably works.

Best,
 
Top