Difference between revisions of "Show/Hide Header"

From SmartWiki
Jump to: navigation, search
Line 66: Line 66:
 
* [[Visibility Condition]]
 
* [[Visibility Condition]]
  
[[Category:Custom Fields]][[Category:Enhancements]][[Category:System Management]][[Category:JavaScript]]
+
[[Category:Custom Fields]][[Category:JavaScript]]

Revision as of 09:09, 31 July 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.

See Also

Visibility of Custom Fields can also be controlled using: