Manipular a exibição de botões dinamicamente

Manipulate a button display dynamically


The most interesting feature in Scriptcase, is the manipulation of the display of buttons in applications, with the macro sc_btn_display ("nomebotao", "on / off"):

To see all the macro documentation click here.

We can use this macro to validate users' permissions to use a button, for example:

We have a form with the New, Update and Delete buttons, and the User and Visitor groups.e.

The User will not be allowed to Delete a record and the Visitor will only be able to view the form.
We put the following code in OnLoad:

if([grupo] == 'usuario'){

    sc_btn_display('delete','off');

}else if([grupo]=='visitante'){
    sc_btn_display('delete','off');
    sc_btn_display('update','off');
    sc_btn_display('new','off');

}


See in execution:

User:

Guest:



    • Related Articles

    • Macro sc_block_display

      In this example, we will see how to use the sc_block_display macro in an Ajax event using a Radio button on a Form, this macro is intended to hide or show a block. The steps in this example: Configuring Radio type field Configuring and creating ...
    • Hide new grid button at runtime

      To hide the grid buttons we will use the sc_btn_display() macro, this macro shows and hides the buttons in the toolbar at run time. 1- We use this macro in the OnScriptInit event of our grid, referring to our new button as “new”: 2- We run the ...
    • Using the sc_field_display macro

      To dynamically hide a field in this example, the macro sc_field_display is used, which is responsible for hiding or dynamically displaying a field or several. This macro has scope in the following events: In this example, it will be used within an ...
    • Navigate between tab dynamically

      In this tutorial we will show how to navigate between tabs dynamically from a tab application. In this example we will use two applications, added in the tab application. In the first tab we will have a form and after inserting a record we will be ...
    • How to create a button link

      Button Link: Used to link the application with any other type of project application. In this type of link a button is used as a link between applications. How to do a button link Make a link button in your application. Set the button as a link ...