Skip to main content
February 23, 2012
Question

How to Enable/Disable form item, with changing on CFSELECT on FLASH type CFFORM.

  • February 23, 2012
  • 1 reply
  • 731 views

Hi,

i have a problem with my small code.

i have a CFFORM on FLASH mode. I have an CFSELECT itehm and 1 CFINPUT TEXT, so i need to Enable my text box when  i select "OTHER" from CFSELECT and disable the text box if i have other choice .

<cfform name="pipe_add" action="kooft.cfm" enctype="multipart/form-data" method="post" format="flash" skin="haloorange" width="300" height="850">

            <cfformitem type="script">

            function dospec(field){

                if(field.value == "0") {

                    _root.p_nspec.enabled = true;

                } else {

                    _root.p_nspec.enabled = false;

                }

            }

            </cfformitem>

            <cfformgroup type="panel" label="Pipe Specification">

                <cfselect name="p_cspec" onchange="dospec(this);" query="pipe_Spec" value="spec_id" display="spec_name" label="Specification :" size="1" width="70"  >

                    <option value = "0" >Other . . .</option>

                </cfselect>

                <cfinput name="p_nspec" label="Other Specification :" size="15" Enabled="False">

            </cfformgroup>

</cfform>

is here anyone can help me ?

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
February 26, 2012

<cfform name="pipe_add" action="kooft.cfm" format="flash"  method="post"  skin="haloorange" width="300" height="850">

<cfformitem type="script" >

function dospec(){                 

    if(p_cspec.value == 0) {

        p_nspec._visible = false;

    }

    else {

        p_nspec._visible = true;

    }

}

</cfformitem>

<cfformgroup type="panel" label="Pipe Specification">

<cfselect name="p_cspec" id="p_cspec"  onchange="dospec()" query="pipe_Spec" value="spec_id" display="spec_name" label="Specification :" size="1" width="70">

    <option value = "0" >Other . . .</option>

</cfselect>

<cfinput type="text" id="p_nspec" name="p_nspec" label="Other Specification :" size="15" Enabled="False">

</cfformgroup>

</cfform>