Difference between revisions of "Show/Hide Header"
Line 5: | Line 5: | ||
The concept is that one [[Custom Fields|custom field]] - the "control field" - is used to control the display of a set of [[Custom Fields|custom fields]] based on a value entered or selected in the control field. | The concept is that one [[Custom Fields|custom field]] - the "control field" - is used to control the display of a set of [[Custom Fields|custom fields]] based on a value entered or selected in the control field. | ||
− | The control field can be any type of [[Custom Fields|custom field]] that can contain a value such as a text box ([[Custom Field Type (30): Text – Single Line|single]] or [[Custom Field Type (40): Text – Multiple Lines|multiple]] line), [[Custom Field Type (10): Select One – Combo Box|Combo box - select one]], [[Custom Field Type | + | The control field can be any type of [[Custom Fields|custom field]] that can contain a value such as a text box ([[Custom Field Type (30): Text – Single Line|single]] or [[Custom Field Type (40): Text – Multiple Lines|multiple]] line), [[Custom Field Type (10): Select One – Combo Box|Combo box - select one]], [[Custom Field Type: Select Many – Check Boxes|Check boxes - select many]], [[Custom Field Type (60): Special – Calculated Value|Calculated field]] or Lookup type field. |
The only field types that cannot be used are fields such as [[Custom Field Type (103): Special – Browser Script|browser script]], [[Custom Field Type: Display Only – Image|Image]] field, etc. | The only field types that cannot be used are fields such as [[Custom Field Type (103): Special – Browser Script|browser script]], [[Custom Field Type: Display Only – Image|Image]] field, etc. |
Revision as of 17:57, 15 April 2009
Overview
This is a new feature designed to support more dynamic pages by providing for control of the visibility of custom fields through values that are entered elsewhere on the page.
The concept is that one custom field - the "control field" - is used to control the display of a set of custom fields based on a value entered or selected in the control field.
The control field can be any type of custom field that can contain a value such as a text box (single or multiple line), Combo box - select one, Check boxes - select many, Calculated field or Lookup type field.
The only field types that cannot be used are fields such as browser script, Image field, etc.
The controlled fields must all be placed under a Title Bar type field.
Example
Place the following code in the HTML Tag box of the Control field:
onchange="_showhideheader(xxxxxx,this.value=='Yes')"
Where xxxxxx is the field ID of the Title Bar field that you wish to control.
Where Yes is the value in the control field that you wish to use to trigger the display of Title Bar and the other Controlled fields in the block.
More complex syntax can also be used:
onchange="_showhideheader(xxxxxx,this.value!='Yes')" Display the controlled fields when the control field is not equal to Yes. onchange="_showhideheader(xxxxxx,(this.value=='Yes' || this.value=='Maybe'))" Display the controlled fields when the control field is either Yes or Maybe. onchange="_showhideheader(xxxxxx,this.value==''") Display the controlled fields when the control field is empty. onchange="_showhideheader(xxxxxx, parseInt(this.value ) >6)" Display the controlled fields when the control field is greater than 6.
If there are a set of fields that are required to be displayed and others to be kept hidden based on values selected from combo box, following syntax may be used:
onchange="_showhideheader(xxxxxx,this.value='A') ;_showhideheader(yyyyyyy,this.value='B') " Display the controlled fields associated with '''Title Bar''' type field ID xxxxxx when the control field is A and display controlled fields associated with '''Title Bar''' type field ID yyyyyyy when the control field is B
**When the Control field is a Select Many Check Box, you will need to use the onclick syntax. Please see the Show/Hide Fields Using a Check Box article.
The difference between this feature and Dynamic Control field is that:
Unlike the Dynamic custom field, there are no fields "nested" within the control field and the set of fields that you wish to control can be located anywhere on the page.
Using nested Dynamic Control fields (dynamic controls within dynamic controls) you cannot report below the first level of nested fields.