Hi ,
Can we restrict specific form button for specific user in home page?
i tried to create different access level to required form but still i can see other form buttons for that user though they are not working.
Regards,
Sandeep
Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
User specific form Access
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: User specific form Access
Hi,
Add this Javascript code in the Header under Home ► Setup
This will hide a button with ID IdOfYourButton if the Access Level Code of the currently logged in user not SUPERUSER.
The code can also be extended to restrict it to a specific form:
I hope that helps...
Add this Javascript code in the Header under Home ► Setup
Code: Select all
function nuOnLoad() {
var acl = nuAccessLevelCode();
if (acl != 'Superuser') {
$("#IdOfYourButton").css('visibility', 'hidden');
}
}
The code can also be extended to restrict it to a specific form:
Code: Select all
function nuOnLoad() {
var f = nuCurrentProperties();
if (nuFormType() == 'edit' && f.form_id == 'nuuserhome') {
var acl = nuAccessLevelCode();
if (acl != 'Superuser') {
$("#IdOfYourButton").css('visibility', 'hidden');
}
}
}
Last edited by Anonymous on Fri Jul 20, 2018 4:11 pm, edited 1 time in total.
-
- Posts: 41
- Joined: Thu Jan 25, 2018 3:51 pm
-
- Posts: 41
- Joined: Thu Jan 25, 2018 3:51 pm
Re: User specific form Access
Getting below warning everytime after adding JavaScript to hide form button. Any suggestion??
Warning: in_array() expects parameter 2 to be array, null given in E:\xampp\htdocs\PMTools_PROD\nudata.php on line 135
{"record_id":"5b5204004799259","user_name":"test","access_level_code":"CM","user_id":"5b51c4571c7e7b9","database":"abc","dimensions":{"browse":{"height":707,"width":1500},"edit":{"height":571,"width":1390},"grid":{"height":"500","width":4291}},"translation":[],"tableSchema":[],"formSchema":[],"session_id":"s15321016108501","callback":"","errors":[],"log_again":null,"global_access":"0","form_access":"0","javascript":null,"target":null,"buttons":{"Add":"1","Print":"1","Save":"1","Clone":"1","Delete":"1","Run":"","RunHidden":""},"run_code":"","run_description":""}
Warning: in_array() expects parameter 2 to be array, null given in E:\xampp\htdocs\PMTools_PROD\nudata.php on line 135
{"record_id":"5b5204004799259","user_name":"test","access_level_code":"CM","user_id":"5b51c4571c7e7b9","database":"abc","dimensions":{"browse":{"height":707,"width":1500},"edit":{"height":571,"width":1390},"grid":{"height":"500","width":4291}},"translation":[],"tableSchema":[],"formSchema":[],"session_id":"s15321016108501","callback":"","errors":[],"log_again":null,"global_access":"0","form_access":"0","javascript":null,"target":null,"buttons":{"Add":"1","Print":"1","Save":"1","Clone":"1","Delete":"1","Run":"","RunHidden":""},"run_code":"","run_description":""}
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
-
- Posts: 41
- Joined: Thu Jan 25, 2018 3:51 pm
Re: User specific form Access
aha found it... This time it is the issue with Subform foriegn key.. its resolved. Thank you very much for the response.