Page 1 of 1

Display Condition for Buttons

Posted: Sat Jan 20, 2018 12:01 am
by toms
Hi,

This is a follow-up question to the locked thread "Display Condition for Objects" http://forums.nubuilder.cloud/viewtopic.php?f=19&t=9232

Where's the best place to control the visibility of buttons on nuhome? E.g. to make certain buttons invisible if nuAccessLevelCode() does not equal globeadmin.

Re: Display Condition for Buttons

Posted: Sat Jan 20, 2018 8:30 am
by admin
toms,

Just put it in the Javascript of the Form.

Code: Select all


if(nuAccessLevelCode()!='' || nuSubformObject('employee_bonuses_subform').rows.length > 2){
    $('#boss_button').remove();
}
It won't do anything when the Form is being run as a Browse.

$('#boss_button') will just be ignored because it's not there.

Steven

Re: Display Condition for Buttons

Posted: Sat Jan 20, 2018 8:33 am
by toms
Is this also valid for buttons under "User Home"?

Re: Display Condition for Buttons

Posted: Sat Jan 20, 2018 9:01 am
by admin
toms,

You can do it on any Form you have access to.

If anything has an id you can remove it with...

Code: Select all

var id = 'run_customer';

$('#' + id).remove()

Steven

Re: Display Condition for Buttons

Posted: Sun Jan 21, 2018 7:48 am
by toms
Steven, the question wasn't really how to do it, but where to place the code.

Options -> Form Properties -> Javascript

Re: Display Condition for Buttons

Posted: Sun Jan 21, 2018 9:03 am
by admin
OK,

As you have figured out, it goes in the Javascript Section of the Form you want it to run on...

http://wiki.nubuilder.net/nubuilderfort ... Javascript

Steven