Message Box

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
dharbitindy
Veteran Member
Posts: 101
Joined: 2019-05-26 18:38

Message Box

Post by dharbitindy » 2020-03-04 01:42

Does anyone know how to make a message box pop up if a condition is met? For instance, if a value is >= 100.00 then popup a message box that states "This value is too high, check your data input". This doesn't have to stop input, or throw an error, just a warning message.

Thank you,
David

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

Re: Message Box

Post by pbottcher » 2020-03-04 07:10

Hi,

you can try to use:

Code: Select all

	show_notification({
			message: "YOUR MESSAGE HERE",
			class: 'danger',
			dismiss_seconds: 30
			});
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.

dharbitindy
Veteran Member
Posts: 101
Joined: 2019-05-26 18:38

Re: Message Box

Post by dharbitindy » 2020-03-04 14:01

Thank you Pascal,

One other thing. Where would be best to put this code? and would this be appropriate?

if($j('#eff_percent').val() >= 100.00)
show_notification({
message: "This is High. Please check your data",
class: 'danger',
dismiss_seconds: 300
});

Thanks again,
David

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: Message Box

Post by D Oliveira » 2020-03-04 17:07

javascript


alert box

Code: Select all

alert('MESSAGE HERE');

confirm box

Code: Select all

var txt;
var r = confirm("Are you sure?");
if (r == true) {
txt = "You pressed OK!";
} else {
txt = "You pressed Cancel!";
}

dharbitindy
Veteran Member
Posts: 101
Joined: 2019-05-26 18:38

Re: Message Box

Post by dharbitindy » 2020-03-04 18:08

Much appreciated, but where would this code need to be placed?

Thank you,
David

dharbitindy
Veteran Member
Posts: 101
Joined: 2019-05-26 18:38

Re: Message Box

Post by dharbitindy » 2020-03-04 18:59

Screen shots;

One is the eff.php file and the other is the eff Detail View.

Thank you,
David
Attachments
eff_detail_view.JPG
eff_detail_view.JPG (54.8 KiB) Viewed 34529 times
eff_php.JPG
eff_php.JPG (81.26 KiB) Viewed 34529 times

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: Message Box

Post by D Oliveira » 2020-03-04 20:03

dharbitindy wrote:
2020-03-04 18:59
Screen shots;

One is the eff.php file and the other is the eff Detail View.

Thank you,
David

hooks/eff-dv.js

Code: Select all

$j(function{

if ( $j('#eff_percent').val() >= 100 ){
alert('This is High. Please check your data');
}

});

dharbitindy
Veteran Member
Posts: 101
Joined: 2019-05-26 18:38

Re: Message Box

Post by dharbitindy » 2020-03-04 21:18

Thank you! I'll give it a try. Much appreciated.

David

dharbitindy
Veteran Member
Posts: 101
Joined: 2019-05-26 18:38

Re: Message Box

Post by dharbitindy » 2020-03-05 02:28

D Oliveira,

Thank you, but this unfortunately didn't show a message. I appreciate your input though.

David

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: Message Box

Post by D Oliveira » 2020-03-05 17:41

dharbitindy wrote:
2020-03-05 02:28
D Oliveira,

Thank you, but this unfortunately didn't show a message. I appreciate your input though.

David
try this:

Code: Select all

$j('#eff_percent').on('change', function(){
if ( $j('#eff_percent').val() >= 100 ){
alert('This is High. Please check your data');
}
});

dharbitindy
Veteran Member
Posts: 101
Joined: 2019-05-26 18:38

Re: Message Box

Post by dharbitindy » 2020-03-05 18:39

This did show the message if I change the value of the eff_percent field however; that is a calculated field so, I think that if I do the calculation in AppGini rather than in the eff.php file, this eff-dv.js code may work. I'll try that and let you know.

Thank you,
David

dharbitindy
Veteran Member
Posts: 101
Joined: 2019-05-26 18:38

Re: Message Box

Post by dharbitindy » 2020-03-05 19:37

Unfortunately that didn't work correctly either. Unless the calculated field value changes (eff_percent) when either the good_parts, or the hrs_ran value(s) change, the message won't show up correctly. It's definitely closer, but not quite working yet. Thanks again though.

David

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: Message Box

Post by D Oliveira » 2020-03-06 03:39

dharbitindy wrote:
2020-03-05 19:37
Unfortunately that didn't work correctly either. Unless the calculated field value changes (eff_percent) when either the good_parts, or the hrs_ran value(s) change, the message won't show up correctly. It's definitely closer, but not quite working yet. Thanks again though.

David
try calculating the field through javascript instead of using appgini built in function.

Code: Select all

$j('#field_a, #field_b').on('change', function(){

	var sum_total = Number($j('#field_a').val()) + Number($j('#field_b').val()) ; // use + or - or / or *
	
	$j('#eff_percent').val(sum_total);
	
	if ( $j('#eff_percent').val() >= 100 ){
		alert('This is High. Please check your data');
	}
	

});


$j('#eff_percent').on('change', function(){
	if ( $j('#eff_percent').val() >= 100 ){
		alert('This is High. Please check your data');
	}
});


dharbitindy
Veteran Member
Posts: 101
Joined: 2019-05-26 18:38

Re: Message Box

Post by dharbitindy » 2020-03-06 17:15

Thank you sir! I'll try it.

David

Post Reply