Message box after insert

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
imike
Posts: 8
Joined: 2020-02-25 15:35

Message box after insert

Post by imike » 2020-04-03 12:23

Hello,
After adding the record, the message box (alert) does not appear. How to solve this problem?

Code: Select all

	function ttr_warehouse_ttr_after_insert($data, $memberInfo, &$args) {

		$quantity = sqlValue("select `ttr_warehouse_ttr`.`quantity` from `ttr_warehouse_ttr` where id='{$data['id']}'");
		if ($data['add_ttr'] == !null) {
		$quantity = $quantity + $data['add_ttr'];
		sql("update `ttr_warehouse_ttr` set `ttr_warehouse_ttr`.`quantity` = '{$quantity}' where id='{$data['id']}'", $eo);
		sql("update `ttr_warehouse_ttr` set `ttr_warehouse_ttr`.`add_ttr` = NULL where id='{$data['id']}'", $eo);

?>	
		<script type="text/javascript">
			$j(document).ready(function(){
			alert('Added: <?php $quantity ?>');
			});
		</script>
<?php	
		}	

		return TRUE;
	}

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

Re: Message box after insert

Post by pbottcher » 2020-04-03 21:14

Hi,

you cannot use the html (<script>...) in the hook file like you do. The hook is called as a function and you cannot modify the DOM via the _before / _after functions.
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.

imike
Posts: 8
Joined: 2020-02-25 15:35

Re: Message box after insert

Post by imike » 2020-04-06 06:14

Heloo pböttcher,

Thank you for your answer. So how can I do it? Using the table_name-dv.js file?

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

Re: Message box after insert

Post by pbottcher » 2020-04-06 19:52

Hi,

have a look into this post.

viewtopic.php?f=7&t=1740&p=10871#p10877

hope that helps
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.

imike
Posts: 8
Joined: 2020-02-25 15:35

Re: Message box after insert

Post by imike » 2020-04-07 13:03

Thank you for your help. I will try to do it this way.

Post Reply