![](//img.zohostatic.com/zde/static/images/file.png)

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.

![](//img.zohostatic.com/zde/static/images/info.png)

The steps in this example:

1. Configuring Radio type field
2. Configuring and creating blocks
3. 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.1**Creating a radio button with the name "Filling"

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=o3xri20a22e2ecc6f4bd299d1f0f5d2d5268d)

![](//img.zohostatic.com/zde/static/images/file.png)

Remember to disable the checkBox to create a new block to position this field

## Configuring Manual Lookup of the Radio Field

**1.2**With 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:

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=o3xri4b6db6039ffa48358c17b47a400a17ff)

![](//img.zohostatic.com/zde/static/images/caution.png)

After configuring each option, click on the "Include" button

**In the onLoad event of your form, place the following code:**

1. {filling} = "s";
2. 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:

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=o3xri7c6efdca63f84974b789099d7cc41bb6)

Organize your separate fields for each block in the Field **Positioning option**, with the following image:

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=o3xri9a6ee0d35a974ee8916fd6cfe3d49482)

## Using the macro in Ajax event

**3**.Create an "onClick" ajax event and use the following code:

1. if({filling} == 'f') {
3. sc\_block\_display('block2', 'on');
5. } else {
7. sc\_block\_display('block2', 'off');
9. }

**3.1**Save 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

![](https://desk.zoho.com/DocsDisplay?zgId=716875472&mode=inline&blockId=o3xri264d03dd77c14d70aedbc7e35102253d)