Page 1 of 1
action button after "Save Changes" was pressed
Posted: 2023-05-30 18:39
by ushay
hello friend,
i have an action button in footer-extras.php to send an email, but i need it to be send only after the user pressed the "Save Changes" button.
is there a way to check if the button was pressed ?
thanks,
shay.
Re: action button after "Save Changes" was pressed
Posted: 2023-05-30 18:51
by jsetzer
First, check if SelectedID is defined at all. Will only be set after very first save (after insert).
Additionally you can hide (or remove) the button in form.onChange event using javascript.
Re: action button after "Save Changes" was pressed
Posted: 2023-05-30 19:30
by ushay
thanks for your reply Jan,
first i am using this code to see if SelctedId is set:
Code: Select all
$checkSelectedID = isset($_POST['SelectedID']) ? makeSafe($_POST['SelectedID']) : 0;
and then i try:
Code: Select all
if (isset($_POST['SelectedID'])) {
if (isset($_POST['submit'])) {
$mail = [
"to" => "[email protected]",
"name" => "× ×©×œ×— על ידי " . $Tname,
"message" => "http://tasks.qlc.co.il:10501/tasks/inventory_report_view.php?SelectedID=" . $checkSelectedID,
"subject" => "התקבל טופס ×”×–×ž× ×ª ציוד בת×ריך " . $json . " מ×ת ×”×˜×›× ××™ " . $Tname,
"debug" => 4
];
sendmail($mail);
}
}
but even when i dont press the save button it still sends the email,why?
Re: action button after "Save Changes" was pressed
Posted: 2023-06-08 18:32
by pbottcher
Hi,
just a short question to understand you need. Why cant you put your code in the _after_update hook?