disable Date for non admins

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

disable Date for non admins

Post by angus » 2022-07-26 16:47

Hi I have tried to disable the date field (it has 3 drop downs, one for day, one for month and one for year) for non admins but have had no success. I have another field that needs to be disabled and it is working ok. Just cant get the Date to be disabled.

Has anyone got this working and could share it with me?

This is a part of the code I am using in the hooks file under function tablename_dv

Code: Select all

                    $html .= <<<EOC
                                        <script>
                                              \$j(function(){
											  \$j('#Name').prop('readonly', true);
											  \$j('#Date').prop('readonly', true);									  
                                              })
                                        </script>
EOC;
I have tried the following by looking at the dml file

Code: Select all

\$j('#DateDay').prop('disabled', true)
\$j('#DateMonth').prop('disabled', true)
\$j('#DateYear').prop('disabled', true)
this didnt work either.
AppGini 22.13

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: disable Date for non admins

Post by angus » 2022-07-26 17:31

OK, I have tried various other permutations and have got everything disabled except the clear button

Code: Select all

\$j('#Date').prop('disabled', true);	
							 \$j('#Date-dd').prop('disabled', true);
							  \$j('#Date-mm').prop('disabled', true);
							  \$j('#fd-but-Date').prop('disabled', true);
							  \$j('#fd-date-clearer').prop('disabled', true);
if anyone knows how to disable this that would be useful
AppGini 22.13

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

Re: disable Date for non admins

Post by pbottcher » 2022-07-26 19:31

Hi,

if you only have one date selection you can try

Code: Select all

$j('.fd-date-clearer').prop('disabled',true)
Otherwise you would need to traverse the date selection from the top class towards the clearer.
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.

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: disable Date for non admins

Post by angus » 2022-07-26 21:49

Pbottcher, this is it, perfect. thank you
AppGini 22.13

Post Reply