The primary distinguishing feature of ColdFusion is its associated scripting language, ColdFusion Markup Language (CFML), which compares to JSP, ASP.NET, or PHP and resembles HTML in syntax. "ColdFusion" is often used synonymously with "CFML", but it should be noted that there are additional CFML application servers besides ColdFusion, and that ColdFusion supports programming languages other than CFML, such as server-side Actionscript and embedded scripts that can be written in a JavaScript-like language, known as CFScript.

Tags |

Coldfusion flash form validate / disable

One of the problems with flash forms in Coldfusion (CFFORM) is that you cant use javascript validation.



In the simple example I show below, here is how you can disable a button until a user checks a box



<cfform format="flash" METHOD="post">
<cfinput name="myCheckbox" type="checkbox"
label="I will obtain and maintain documented approval prior to my departure."
enabled="true"
required="yes"
onclick="submitBtn.enabled=myCheckbox.selected;"/>

<cfinput type="Submit" name="submitBtn" value="Submit" enabled="false">

</cfform>


Here is how you could hide a text box after a user clicks on a text feild



<cfinput type="text" label="Time (hh) in 24 hour format [0-24]:[00-59]" name="time" width="50" onChange="time_sub.enabled=true;text_1.visible=false;" validate="range" range="1,24" message="Must be from 1-24" maxlength="2">

<cfformgroup type="horizontal">

<cfinput type="submit" name="time_sub" value="Submit" enabled='false'>

<cfinput type="text" value="You must enter a time" visible="true" name="text_1" readonly="yes" width="200">

</cfformgroup>


Hope this helps some one else, I know it took me some work to figure out




Comments

From
2010-06-10 20:35:03

Find Ben Forta, books, show you how to use client side validation that embed javascript to flashform automatic,


Feel free to leave a comment or question

Name: (Optional but appreciated):

Comment:

Use [code] [/code] for code block style



Security Code: