
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 blocks
- Using Macro in Ajax Event
The macro has the following scope:
| Calendar application | chart application | Grid application | Form application | Control Form |
| onAfterInsert onAfterUpdate onScriptInit onLoad onRefresh onValidate onValidateFailure onValidateSuccess | onScriptInit | onScriptInit onRecord | onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onScriptInit onLoad onNavigate onLoadRecord onRefresh onValidate onValidateFailure onValidateSuccess | onClick onScriptInit onLoadAll onRefresh |
Configuring Radio type field
1.We will be using a Radio type button as a flag to enable the block or disable it, that way we will be creating a Manual lookup to put two options available (Full and Simple)
1.1Creating a radio button with the name "Filling"

Remember to disable the checkBox to create a new block to position this field
Configuring Manual Lookup of the Radio Field
1.2With the field already created, choose the Manual Lookup option with the following labels (Full and Simple) with the following values respectively ("f" and "s"), as shown below:

After configuring each option, click on the "Include" button
In the onLoad event of your form, place the following code:
- {filling} = "s";
- sc_block_display('block2','off');
Configuring and adding blocks
2. We will be at this stage creating our block to be used in the macro.
2.1 In your form click on Layout-> Blocks
Create a block called "block2" as follows:
Organize your separate fields for each block in the Field Positioning option, with the following image:
Using the macro in Ajax event
3.Create an "onClick" ajax event and use the following code:
- if({filling} == 'f') {
- sc_block_display('block2', 'on');
- } else {
- sc_block_display('block2', 'off');
- }
3.1Save and run the application.
When clicking on the option "Full", the entire block will be shown, and when clicking on the option "Simple" the block will be collapsed