How do I change the visibility of a "block" based on the selection of a field?

Background:

I have a form “app” that has a small top block that must remain visible at all times. There is only one database field in the top part called “Schedule Type”. It is a “Select” input, and it has 3 choices:

  • Automatic
  • Manual
  • Off

Situation:

I have built 3 blocks that are currently under the top block. Each block has a title, and has it’s own set of fields. The titles and fields are as follows:

  • Title: “Automatic” Contains Fields: Fields for Automatic
  • Title: “Manual” Contains Fields: Fields for Manual
  • Title: “Off” Contains Fields: Fields for Off

Question:

When the form first opens, I need to only show the appropriate block that relates to the current setting of the “Select” at the top. Once the form is open, if the user changes the “Select” to a different value, the appropriate block must be made visible and the other blocks made invisible. How do I accomplish this? I cannot find a similar question in the forums, and there is no SC video about how to do this. Thanks in advance for any help you can provide.

Have a look at the macro sc_block_display

Thanks William. Was easy and works perfect. I used sc_block_display in the onLoad and made an Ajax event on the field for the change. Ok, SC8 is now earnings it’s pay.