-
bescott53
Post
by bescott53 » 2018-06-22 12:46
Ahmed, I have used the code you have on the support pages below to make a field read only but it does not seem to work, can you help?
http://bigprof.com/appgini/help/advance ... ter_update
Code: Select all
function tablename_dv($selectedID, $memberInfo, &$html, &$args){
/* current user is not an admin? */
if($mi['group'] != 'Admins'){
$html .= <<<EOC
<script>
\$j(function(){
\$j('#price').prop('readonly', true);
})
</script>
EOC;
}
}
-
pböttcher
- AppGini Super Hero

- Posts: 1590
- Joined: 2018-04-01 10:12
Post
by pböttcher » 2018-06-22 14:43
Hi,
what kind of field do you try to make readonly. Can you post the code you actually used in your project?
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.
-
bescott53
Post
by bescott53 » 2018-06-22 15:15
sure, i moved this on though. i created a file in the hooks folder called "commission_approval-dv.js" and then pasted this into it
Code: Select all
$j(function () {
if($mi['group'] != 'Admins'){
$j(function(){
$j('#approvedby_so').prop('readonly', true);
})
}
});
-
pböttcher
- AppGini Super Hero

- Posts: 1590
- Joined: 2018-04-01 10:12
Post
by pböttcher » 2018-06-22 15:44
ok, so what type of field is the #approvedby_so ? is it a text field or a selection.
Also did you check that your user is not part of the admins group?
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.
-
bescott53
Post
by bescott53 » 2018-06-22 16:05
thanks pbottcher, it is a selection, blank by default with the option of yes or no or blank. the person is not in the admins group as only i am in that.
-
pböttcher
- AppGini Super Hero

- Posts: 1590
- Joined: 2018-04-01 10:12
Post
by pböttcher » 2018-06-22 18:09
Hi,
in case you have a selection field you need to apply the following instead the prop:
Code: Select all
$j(function () {
if($mi['group'] != 'Admins'){
$j(function(){
$j(#approvedby_so-container').attr('disabled', true);
})
}
});
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.
-
bescott53
Post
by bescott53 » 2018-06-25 08:47
Hi, thankyou for this however i can still see this if i am not in the admins group? doesnt appear to work
-
pböttcher
- AppGini Super Hero

- Posts: 1590
- Joined: 2018-04-01 10:12
Post
by pböttcher » 2018-06-25 10:23
Hi,
sorry, can you try this:
Code: Select all
$j(function () {
if($mi['group'] != 'Admins'){
$j(#approvedby_so-container').prop("disabled", true);
}
});
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.
-
bescott53
Post
by bescott53 » 2018-06-25 14:42
not having any luck with this at all.
Code: Select all
$j(function () {
if($mi['group'] != 'Admins'){
$j('#approvedby_so-container').prop("disabled", true);
}
});
-
pböttcher
- AppGini Super Hero

- Posts: 1590
- Joined: 2018-04-01 10:12
Post
by pböttcher » 2018-06-25 17:46
Hi,
can you post a screenshot of the console view of your field. Maybe the name is not correct.
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.
-
bescott53
Post
by bescott53 » 2018-06-26 09:27
thanks, I have checked the console but it is blank. looked in Dom explorer and saw the attached

- attached.png (55.86 KiB) Viewed 10502 times
-
pböttcher
- AppGini Super Hero

- Posts: 1590
- Joined: 2018-04-01 10:12
Post
by pböttcher » 2018-06-26 09:43
Hi,
this looks strange. Is this a select2 dropdown created by appGini? I cannot see the approvedby_so id in the screenshot. Can you doublecheck.
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.
-
bescott53
Post
by bescott53 » 2018-06-26 09:54
it is pbottcher. is it due to using a different theme maybe? (still supplied by appgini)
-
a.gneady
- Site Admin
- Posts: 1221
- Joined: 2012-09-27 14:46
-
Contact:
Post
by a.gneady » 2018-06-26 10:55
bescott53 wrote: ↑2018-06-25 14:42
not having any luck with this at all.
Code: Select all
$j(function () {
if($mi['group'] != 'Admins'){
$j('#approvedby_so-container').prop("disabled", true);
}
});
Just wish to make a small correction to the code above as it's mixing PHP syntax with JavaScript code ... I didn't test the code below but give it a try and let's see how it goes:
Code: Select all
if($mi['group'] != 'Admins'){ ?>
<script>
$j(function () {
$j('#approvedby_so-container').prop("disabled", true);
});
</script>
<?php }
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
-
bescott53
Post
by bescott53 » 2018-06-26 11:02
thanks Ahmed, but still doesnt work?
-
a.gneady
- Site Admin
- Posts: 1221
- Joined: 2012-09-27 14:46
-
Contact:
Post
by a.gneady » 2018-06-26 11:10
Hi bescott ... OK, referring to the code at the top of the thread, try this:
Code: Select all
function tablename_dv($selectedID, $memberInfo, &$html, &$args){
/* current user is not an admin? */
if($mi['group'] != 'Admins'){
$html .= <<<EOC
<script>
\$j(function(){
\$j('#approvedby_so-container').prop('disabled', true);
})
</script>
EOC;
}
}
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
-
bescott53
Post
by bescott53 » 2018-06-26 12:52
I am getting http500 error with this
-
bescott53
Post
by bescott53 » 2018-06-26 13:55
so i removed the last } but it still isn't working although no 500 error now.
-
pböttcher
- AppGini Super Hero

- Posts: 1590
- Joined: 2018-04-01 10:12
Post
by pböttcher » 2018-06-26 14:52
can you post an image where we can see your field in the appGini application definition and in the Web-GUI.
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.
-
bescott53
Post
by bescott53 » 2018-06-26 16:45
sure , here you go
-
Attachments
-

- attached.png (59.04 KiB) Viewed 10473 times
-
pböttcher
- AppGini Super Hero

- Posts: 1590
- Joined: 2018-04-01 10:12
Post
by pböttcher » 2018-06-26 19:17
ok, do it is an option list. Can you remove the "-container" and try again.
Code: Select all
function commision_approvals_dv($selectedID, $memberInfo, &$html, &$args){
/* current user is not an admin? */
if($memberinfo['group'] != 'Admins'){
$html .= <<<EOC
<script>
\$j(function(){
\$j('#approvedby_so').prop('disabled', true);
})
</script>
EOC;
}
}
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.
-
bescott53
Post
by bescott53 » 2018-06-27 13:22
nope still no joy!
-
pböttcher
- AppGini Super Hero

- Posts: 1590
- Joined: 2018-04-01 10:12
Post
by pböttcher » 2018-06-27 14:05
can you pls post where you put the code and the code you have pls.
I just saw that there is a typo in the commision above. It should of course be commission.
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.
-
bescott53
Post
by bescott53 » 2018-06-28 12:36
grimblefritz, thank you. i will read through and come back with an update
pböttcher - attached for info

- SnipImage.JPG (128.61 KiB) Viewed 10423 times