action button after "Save Changes" was pressed

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
ushay
Veteran Member
Posts: 54
Joined: 2020-06-26 21:30

action button after "Save Changes" was pressed

Post by ushay » 2023-05-30 18:39

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.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: action button after "Save Changes" was pressed

Post by jsetzer » 2023-05-30 18:51

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.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

ushay
Veteran Member
Posts: 54
Joined: 2020-06-26 21:30

Re: action button after "Save Changes" was pressed

Post by ushay » 2023-05-30 19:30

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?

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: action button after "Save Changes" was pressed

Post by pbottcher » 2023-06-08 18:32

Hi,

just a short question to understand you need. Why cant you put your code in the _after_update hook?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Post Reply