Whatever message this page gives is out now! Go check it out!
<cfoutput>Hello World</cfoutput><cfset myvar = “Hello World”>
<cfoutput>#myvar#</cfoutput>
</cfclient><cfset x=“abc.cfm”>
<cfinclude template=“#x#”>
</cfclient><cfoutput>#CreateDateTime( 1776, 7, 4, 12, 59, 0)#</ cfoutput ><cfset mytimespan = #createtimespan(2, 1, 16, 30)#>
<cfoutput>#date1 + mytimespan#</cfoutput>
<cfoutput>#DateFormat(date1 + mytimespan)#</cfoutput>anumeric = arrayNew(1);
anumeric[1] = 01;
anumeric[2] = 001;
anumeric[3] = 1;
anumeric[4] = 1.001;
anumeric[5] = 1.1;
anumeric[6] = 1.101;
anumeric[7] = 1.109;
anumeric[8] = 1.11;
anumeric[9] = 2;
anumeric[10] = 02;
anumeric[11] = 00002;
anumeric[12] = 20;
anumeric[13] = 50;
anumeric[14] = 1.0E+2;
anumeric[15] = 100;
anumeric[16] = 1000;
anumeric[17] = 1.0E+5;
</cfscript>
<cfset arraySort(anumeric, "text")>
<cfloop array="#anumeric#" index=i>
<cfoutput>#i#</cfoutput>
</cfloop><cfset str2 = {name: 'str2', value1: str1, value2: str1}>
<cfset str2dup = duplicate(str2)><cfoutput>
<div id="result"></div>
</cfoutput>
<cfset document.getElementById("result").innerHTML = "Hello">
<cfclient><div id="myDiv"></div>
<cfclient>
<cfset document.getElementById("myDiv").innerHTML += "<div id=""result""></div>
<cfset document.getElementById("result")+="Hello">
</cfclient><cfoutput>
<div id="result"></div>
</cfoutput>
<cfflush>
<cfset document.getElementById("result").innerHTML = "Hello">
<cfclient>{
function init ()
{
cfclient.loadJSFile("yourjsfile.js", function ()
{
alert("Script loaded");
});
}
}<cfscript>
try
{
//Your code that throws an exception
}
catch (e)
{
// This statement will be reached unlike
// in typical asynchronous model
}
</cfscript>component
{
public boolean function isauthorized(String accesstoken) {
//Write logic for accesstoken validation
return true;
}
public boolean function validateparameters(Struct context){
writedump(var=context,output='console');
return true;
}
}component
{
public boolean function validateparameters(Struct context){
// context.functionname
// context.line
// context.file
// context[0] - Data object - Requires deserialization
objectData = deserializeJSON(context[0])
writeDump(var=context.functionname,output='console');
writeDump(var=serializeJSON(objectData.ROWCOUNT),output='console');
return true;
}
}<cfclientsettings mobileserver='http://your-server:port-number/'
enabledeviceapi="false"
validationcfc="/usr/local/htdocs/validationFlow/_cfquery.cfc">
<cfclient>
<cfquery name="q1" type="server" datasource = "cfartgallery">
select * from art
</cfquery>
<cfoutput>#serializeJSON(q1)#</cfoutput>
<cfoutput>Expected: Database Data</cfoutput>
</cfclient><cfclient>
<cfset myVar1 = 1>
<cfset myVar2 = “hello”>
<cfset myVar3 = true>
</cfclient><cfclient>
<cfset myStruct = structNew()>
<cfset myStruct.key1= “hello”>
<cfif structKeyExists(myStruct, “key1”)>
...
</cfif>
</cfclient><cfclient>
<cfset myArray = arrayNew(1)>
<cfset myArray[1] = “hello”>
</cfclient><cfclient>
<cfif arrayLen(myArray) gt 1 >
...
</cfif>
<!--- using the math function--->
<cfset sum = arraySum(myArray) >
<!--- using the date/time function--->
<cfset currentDate = now() >
<!--- using the locale function--->
<cfset locale = getLocale() >
</cfclient><cf_mytag myname=#myvalue#><cf_mytag myname1=#myvalue1# myname2=#myvalue2#>#attributes.myname1# and #attributes.myname2#<cfset caller.myname=#attributes.myname1# & " " & #attributes.myname2#><cfset args=structNew()>
<cfset args.x = "‐X‐">
<cfset args.y = "‐Y‐">
<cf_mytag arg1="value1" attributeCollection=#args# anotherarg="16"><cfif thisTag.hasEndTag is 'false'>
<!‐‐‐ Abort the tag‐‐‐>
<cfabort />
</cfif><cfif thisTag.executionMode is 'start'>
<!‐‐‐ Process start tag ‐‐‐>
<cfelseif thisTag.executionMode is 'end'>
<!‐‐‐ Process end tag ‐‐‐>
</cfif><cfif thisTag.executionMode is 'end'>
<cfset thisTag.generatedContent ='<!‐‐#thisTag.generatedContent#‐‐>'>
</cfif><cfassociate baseTag="tagName" dataCollection="collectionName"><cfparam Name='thisTag.assocAttribs' default=#arrayNew(1)#><cfset ancestorlist = getBaseTagList()>Server-side CFML | Client-side CFML |
caller.cfm customtag.cfm <cf_customtag value1="old_value"> <cfoutput> #variables.old_value# <cfoutput> <cfoutput> #old_value# <cfoutput> <cfset caller[attributes.value1]="new_value"/> | caller.cfm customtag.cfm <cfclient> <cf_customtag value1="old_value" > <cfoutput>#variables.old_value#<cfoutput> </cfclient> <cfset caller[attributes.value1]="new_value"/> |
Server-side CFML | Client-side CFML |
<>cfset divid = "#attributes.div_id#" | The above code will not work. Use: <cfset divid = "#attributes.div_id#"> <cfset divid = #attributes.div_id#> |
<cf_custom attr1="1"><cf_custom attr1=1><cfset x = 1>
<cf_custom attr1=#x#>Server-side CFML | Client-side CFML |
<cffunction name="func1"> <cfretrurn "Hello"> </cffunction> <cf_custom> <cfset caller.func1()> | The functions defined in the caller CFM are not available in the custom tags. |
Server-side CFML | Client-side CFML |
<cfset path="someCFM.cfm"> <cfinclude template=#path#> | This is not supported. |
Server-side CFML | Client-side CFML |
<cfset path="someCFM.cfm"> <cfmodule template=#path#> | This is not supported as we need to do the translation during the compile time itself. |
<cfinclude template="utils.js">
or
<cfinclude template="new.css">component client=true
{
public function foo()
{
//some code here
}
}<cfclient>
<!-- Create a JS proxy of server side component myCFC.cfc‐‐‐>
<cfset proxy = new app1.controls.myCFC(id)>
<!-- Update some data ‐‐‐>
<cfset proxy.setVar("myVar1")>
<cfset proxy.setProperties(someStructVar)>
</cfclient><cfclient>
<cfset obj = new mycfc()>
<cfset obj1 = createObject(“component”,”mycfc”)>
</cfclient><cfclient>
<cfset obj = new mycfc()>
<!--- mycfc extends mycfc1.cfc present in the same directory --->
<cfset result = obj.getResult() >
<!--- getResult() function present in mycfc1.cfc and can be
accessed from the extending classes --->
</cfclient><cfimport path=“com.*” />
<cfset obj = new com.mycfc() />
<!--- mycfc present in directory mapped to com --->
You can also use functions within a CFC:
<cfclient>
<cfset obj = new mycfc() >
<cfset obj.foo() >
<!--- invoke function on cfc instance --->
</cfclient><div id="actual_1" class="async_actual">
<cfclient>
<cfquery datasource="cfds" >drop table if exists birthDates</cfquery>
<cfquery datasource="cfds" >
CREATE TABLE if not exists birthDates(
serialNo INTEGER PRIMARY KEY AUTOINCREMENT,
firstname VARCHAR(20), lastname VARCHAR(20), dob TEXT)
</cfquery>
<!---Insert string. --->
<cfquery datasource="cfds" name="q1">
INSERT INTO birthDates(firstName, lastname,dob) VALUES('Jon', 'Doe', 'Mark')
</cfquery>
<cfset d1=createDate(1975, 12, 25)>
<cfset a=dateFormat(d1,"yyyy-mm-dd")>
<cfquery datasource="cfds" name="q2">
INSERT INTO birthDates(firstName, lastname, dob) VALUES('Jon', 'Doe', '#a#')
</cfquery>
<cfset d2=createDate(1980, 01, 01)>
<cfset b=dateFormat(d2, "yyyy-mm-dd")>
<cfquery datasource="cfds" name="q2">
INSERT INTO birthDates(firstName, lastname, dob) VALUES('Jon', 'Doe','#b#')
</cfquery>
<cfset d3=createDate(1985, 12, 27)>
<cfset c=dateFormat(d3, "yyyy-mm-dd")>
<cfquery datasource="cfds" name="q3">
INSERT INTO birthDates(firstName, lastname, dob) VALUES('Jon', 'Doe','#c#')
</cfquery>
<cfset startRow="2">
<cfset endRow="4">
<cfquery datasource="cfds" name="q4" result="test">
SELECT * FROM birthDates where serialNo between <cfqueryparam value="#startRow#"> and <cfqueryparam value="#endRow#">
</cfquery>
<cfset write_to_div("actual_1", test.sql & "<br>" & test.recordCount & "<br>" & test.columnList)>
<cfloop query="q4">
<cfset write_to_div("actual_1", firstname & " " & lastname & ":" & dob &"<br>")>
</cfloop>
</cfclient>
<script type="text/javascript">
function write_to_div(div_id,data_to_write)
{
document.getElementById(div_id).innerHTML+=data_to_write;
}
</script>
</div>