set multiple conditions which, if they occur together, make two checkbox fields disabled

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
fgazza
Veteran Member
Posts: 205
Joined: 2019-04-30 17:37

set multiple conditions which, if they occur together, make two checkbox fields disabled

Post by fgazza » 2020-06-28 16:49

Hi everyone.
I have two checkbox fields named field1 and field2 and a calculated field named is_complete.
I wish if the condition 1 and 2 and 3 are all true the fields field1 and field2 become disabled.

Here are the condition 1, 2 and 3:
1) the logged in user does not belong to the Admins group and does not belong to the Admins2 group
2) the record was created more than 5 minutes ago
3) the value of is_complete is "1"

I prepared this code:

Code: Select all

if ($memberInfo['group'] != 'Admins' && $memberInfo['group'] != 'Admins2'){
			if($creationDate < strtotime('5 minutes ago')) {
			ob_start();
			?>
			<script>
				$j(function() {
					$j('#field1').attr("disabled", true);
				})
				$j(function() {
					$j('#field2').attr("disabled", true);
				})
			</script>
			<?php
			$html .= ob_get_clean();
		};
		
	}
but I don't know if it's right and I don't know how to add the condition "if is_complete" = "1"

Can someone help me?

Thank you!

Fabiano

Post Reply