Description

Disables the source bind.

Function syntax

ColdFusion.Layout.disableSourceBind(Id)

Parameters

  • Id: Name of the layout area.

Usage

Assume that you are using Coldfusion.navigate to populate content into tab or accordion panels. You can have instances where content comes from the source bind call if the source attribute is defined for cflayoutarea (and is not from ColdFusion.navigate).In such instances, you might disable the source bind to get content using Coldfusion.navigate.

Example

layout.cfm uses the templates Tab1_Src.cfm, Tab2_Src.cfm, and Tab3_Src.cfm. If you run layout.cfm, you notice that clicking

  • navigate populates content of tab2_src.cfm instead of navigate.cfm
  • Disable Source bind ensures that the content of navigate.cfm is populated in tab2_src
  • Enable Source Bind and then clicking tab2_src would again populate the content of tab2_src
    Tab1_Src.cfm

    <br><cfdump var="#CGI#" keys="15" label="[CGI scope]"><br>

    Tab2_Src.cfm

    <br><cfdump var="#server#" label="[Server scope]"><br>

    Tab3_Src.cfm

    <br><cfdump var="#server.coldfusion#" label="[Showing key coldfusion in server scope]"><br>

    Tab4_Src.cfm__

    <br><cfdump var="#server.os#" label="[Showing key OS in server scope]"><br>

    layout.cfm

    <script>
    var navigateToTab = function(layoutId,tabId){
    alert("Navigating to " + tabId);
    ColdFusion.Layout.selectTab(layoutId,tabId);
    ColdFusion.navigate('navigate.cfm',tabId);
    }
    var disableBind = function(tabId){
    alert("Disabling binding on source for " + tabId);
    ColdFusion.Layout.disableSourceBind(tabId);
    }
    var enableBind = function(tabId){
    alert("Enabling binding on source for " + tabId);
    ColdFusion.Layout.enableSourceBind(tabId);
    }

    </script>
    <cflayout type="tab" name="layout1">
    <cflayoutarea
    name = "tab1"
    overflow = "auto"
    refreshonactivate = "yes"
    title = "Tab 1"
    source = "tab1_src.cfm"/>
    <cflayoutarea
    name = "tab2"
    overflow = "auto"
    refreshonactivate = "false"
    title = "Tab 2"
    source = "tab2_src.cfm"
    bindonload=false
    />
    <cflayoutarea
    name = "tab3"
    overflow = "auto"
    refreshonactivate = "yes"
    title = "Tab 3"
    source = "tab3_src.cfm"
    />
    </cflayout>
    <cfform name="myform">
    <cfinput type="button" name="disable" value="Disable Source Bind" onClick="javascript:disableBind('tab2')">
    <cfinput type="button" name="b" value="Navigate" onClick="javascript:navigateToTab('layout1','tab2')">
    <cfinput type="button" name="disable" value="Enable Source Bind" onClick="javascript:enableBind('tab2')">
    </cfform>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy