Skip to main content

Posts

Showing posts from April, 2009

How to create a modal Window in ColdFusion

cfwindow - create modal window cfwindowModal.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfwindow tag: how to create modal window in coldfusion</title> </head> <body> <h2 style="color:SaddleBrown; font-style:italic">cfwindow tag example: Modal Window</h2> <hr width="400" align="left" color="CadetBlue" /> <br /> <cfwindow name="FunnyWindow" title="Funny Image" initshow="true" resizable="false" height="400" width="450" modal="true" > <img src="Images/Funny.jpg" height="300" width="400"/> </cfwindow> </body> </html> More ColdFusion examples cfwindow DayOfWeekAsString()...

How to use CFwindow in ColdFusion

cfwindow cfwindow.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfwindow tag: how to use cfwindow in coldfusion</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">cfwindow tag example: how to use</h2> <hr width="400" align="left" color="CadetBlue" /> <br /> <cfwindow name="FlowerWindow" title="Flower Image" initshow="true" modal="false" resizable="false" height="450" width="550" > <img src="Images/Flowers.gif"/> </cfwindow> </body> </html> More ColdFusion examples cftry and cfcatch - catch exception and handle error cfdiv cfscript - array in script cfwindow - creat...

How to use ColdFusion.navigate Ajax JavaScript Function

Ajax JavaScript Function - ColdFusion.navigate ColdFusionnavigate.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Ajax JavaScript Function: how to use ColdFusion.navigate in coldfusion</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">Ajax JavaScript Function example: ColdFusion.navigate</h2> <hr width="500" align="left" color="PaleVioletRed" /> <br /> <a href="JavaScript:ColdFusion.navigate('PenguinImage.cfm','TestWindow')">Click for see Penguin image</a> <br /> <a href="JavaScript:ColdFusion.navigate('DolphinImage.cfm','TestWindow')">Click for see Dolphin image</a> <cfwindow name="TestWindow" title="ImageView" ini...

How to use ColdFusion.Window.create Ajax JavaScript Function

Ajax JavaScript Function - ColdFusion.Window.create ColdFusionWindowcreate.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Ajax JavaScript Function: how to use ColdFusion.Window.create in coldfusion</title> </head> <body> <h2 style="color:Crimson; font-style:italic">Ajax JavaScript Function example: ColdFusion.Window.create</h2> <hr width="600" align="left" color="CadetBlue" /> <br /> <cfajaximport tags="cfwindow"> <a href="JavaScript:ColdFusion.Window.create('CatWindow','Cat Image','CatImage.cfm')"> <b>Click here for see Cat image</b> </a> </body> </html> CatImage.cfm <img src="Images/Cat.jpg" /> More ColdFusion examples ...

How to create a Presentation in ColdFusion

Introduction Creating presentations in ColdFusion can be a powerful way to dynamically display content within web applications. The <cfpresentation> tag in ColdFusion allows developers to create a series of slides that can contain text, images, or other media, similar to a PowerPoint presentation. This tutorial will guide you through using the <cfpresentation> tag to make an image-based presentation with a set duration for each slide. In the example provided, the code showcases how to create a presentation featuring images of a cat and a rat, each displayed on its own slide. This tutorial will break down the code example to help you understand the structure and application of <cfpresentation> and <cfpresentationslide> tags, offering a step-by-step guide on styling, content placement, and defining timing for each slide. Understanding the <cfpresentation> Tag The <cfpresentation> tag serves as the main container for all slides in a ColdFusion pre...

ColdFusion CFscript - Get query result output in script

cfscript - get query result output cfscriptQuery.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfscript tag: How to get query result output in cfscript</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">cfscript example: Query Output</h2> <hr width="350" align="left" color="PaleVioletRed" /> <cfquery name="qEmployee" datasource="cfdocexamples"> SELECT Emp_ID, FirstName, LastName FROM Employees </cfquery> <h3 style="color:RosyBrown; font-style:italic;"> <u>Employee List</u> <br /> <cfscript> for(Counter=1; Counter LTE qEmployee.RecordCount; Counter++) { WriteOutput(qEmployee.Emp_ID[Counter]); WriteOutput(" : "); WriteOutput(qEmployee...

How to preserve data in a Form in ColdFusion

Introduction In web development, preserving user data in form fields after a page reload or submission is a common challenge. ColdFusion offers an elegant way to handle this through the cfform tag's preservedata attribute. By enabling this feature, ColdFusion ensures that user-entered data remains intact even after submitting the form, providing a smoother and more user-friendly experience. This tutorial demonstrates how to use the preservedata attribute in ColdFusion forms and explains the core mechanics behind it. This example illustrates how ColdFusion can manage form data, presenting a simple use case where a user enters their name and address. The form preserves the user's input and displays it back to them upon submission, ensuring the data remains visible without needing to refill the form fields after the page reloads. Preserving Form Data with cfform ColdFusion's cfform tag simplifies the creation of interactive forms with built-in support for preserving data. ...

How to upload only image file in coldfusion

cffile - upload only image file cffileUploadImge.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cffile tag: how to upload only image file in coldfusion</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">cffile example: Upload Image</h2> <hr width="350" align="left" color="PaleVioletRed" /> <cfset UploadFolder="C:\UploadImage"> <h3 style="color:DeepPink; font-style:italic;"> <cfoutput> <cfif DirectoryExists(UploadFolder)> <cfif IsDefined("Form.UploadFile") AND Form.UploadFile NEQ ""> <cftry> <cffile action="upload" filefield="UploadFile" destination="#Uplo...

asp.net - How to change Panel horizontal align programmatically

Change Panel horizontal alignment programmatically The Panel represents a control that acts as a container for other controls. The Panel is especially useful when the asp.net developers want to generate controls programmatically, hide and show a group of controls, or localize a group of controls. The Panel’s Direction property is used to display text in the Arabic language. The following asp.net c# tutorial code demonstrates how we can change the horizontal alignment of a Panel web server control. Here we change the Panel’s horizontal alignment to center and right programmatically. In the below code example, we used the Panel control’s HorizontalAlign property to change its horizontal alignment programmatically. The Label HorizontalAlign property gets or sets the horizontal alignment of the contents within the panel. The HorizontalAlign property value is one of the HorizontalAlign values. The default value of this property is NotSet. Th...

asp.net - How to show and hide a Panel programmatically

Show (visible) and hide Panel programmatically The Panel is an asp.net web server control that acts as a container control for other asp.net controls and HTML elements. Panel inside controls act as a group of controls. So we can apply common properties of the Panel's inside controls by setting the panel's properties such as showing or hiding all controls, aligning and directing controls, etc. Panel Visible property accepts a Boolean value. if we set the Panel Visible property value to false then it hides all inside controls from the web page with the Panel itself. Panel Visible property value True means the Panel and its inside controls will render in web pages and all elements are visible to visitors. We can control the Panel and its inside controls visibility using Panel's Visible property. The Visible property value True and False works as a switch to rendering or not rendering the Panel on the web page. The Panel acts as a par...

ColdFusion CFscript - Perform while loop in script

cfscript - while loop in script cfscriptWhile.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfscript tag: How to use while loop in cfscript</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">cfscript example: while loop</h2> <hr width="350" align="left" color="PaleVioletRed" /> <br /> <b> <cfscript> counter = 1; while(counter LTE 5){ WriteOutput("Counter Now: #counter# <br />") ; counter = counter+1; } </cfscript> </b> </body> </html> More ColdFusion examples cftry and cfcatch - catch exception and handle error cfdiv cfscript - array in script cfscript - if else conditional statement in script cfscript - structure in script cfscript - switch, case,...

ColdFusion CFscript - Create custom function in script

cfscript - create, call and use function cfscriptFunction.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfscript tag: How to create, call and use function in cfscript</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">cfscript example: create function</h2> <hr width="350" align="left" color="PaleVioletRed" /> <h3 style="color:CornflowerBlue;"> <cfscript> function hello (userName){ sayHello = "Hello #userName# !"; return sayHello; } WriteOutput("#hello("Jones")#"); </cfscript> </h3> </body> </html> More ColdFusion examples cfscript - call user defined function (UDFs) in script cfscript - do while loop in script cfscript - ...

ColdFusion CFscript - For loop in script

cfscript - for loop in script cfscriptForLoop.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfscript tag: How to use for loop in cfscript</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">cfscript example: for loop</h2> <hr width="350" align="left" color="PaleVioletRed" /> <h4 style="color:DarkBlue;"> <cfscript> for(i=1; i LTE 10; i++){ WriteOutput("Current Position: #i# <br />") ; } </cfscript> </h4> </body> </html> More coldfusion examples cfscript - call user defined function (UDFs) in script cfscript - do while loop in script cfscript - create, call and use function in script cfwindow cfwindow - modal window ajax function -...

ColdFusion CFscript - Do while loop in script

cfscript - do while loop in script cfscriptDoWhile.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfscript tag: How to use do while loop in cfscript</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">cfscript example: do while loop</h2> <hr width="350" align="left" color="PaleVioletRed" /> <h4 style="color:SeaGreen;"> <cfscript> counter = 1; do{ WriteOutput("Current Position: #counter# <br />") ; counter = counter+1; } while(counter LTE 6); </cfscript> </h4> </body> </html> More ColdFusion examples cftry and cfcatch - catch exception and handle error cfdiv cfscript - if else conditiona...

ColdFusion CFscript - Call user defined function in script

cfscript - call user defined function (UDFs) in script cfscriptCallFunction.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfscript tag: How to call user defined function (UDFs) in cfscript</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">cfscript example: function call</h2> <hr width="350" align="left" color="PaleVioletRed" /> <cffunction name="Hello" access="remote"> <cfargument name="userName" type="string"> <cfreturn "Hello #userName# !"> </cffunction> <h3 style="color:SaddleBrown;"> <cfscript> WriteOutput("#Hello("Jenny")#"); </cfscript> </h3> </body> </html> Mo...

ColdFusion CFscript - Switch case statement in script

cfscript - switch, case, default statement in script cfscriptSwitch.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>How to use switch, case, default statement in cfscript tag</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">cfscript example: switch statement</h2> <hr width="350" align="left" color="PaleVioletRed" /> <br /> <cfform name="HelloForm" method="post"> Favorite Color: <cfinput type="text" name="FavColor"> <cfinput name="Submit" type="submit" value="Submit"> </cfform> <br /> <cfscript> if (IsDefined("Form.Submit") and (Form.FavColor neq "")) { switch(Form.FavColor){ ca...

ColdFusion CFscript - Create Structure in script

cfscript - structure in script cfscriptStructure.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfscript tag: How to create and use structure in cfscript</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">cfscript example: Structure</h2> <hr width="350" align="left" color="PaleVioletRed" /> <br /> <cfscript> ColorStruct = StructNew(); ColorStruct.Name = "BlueViolet"; ColorStruct.Value = "##8A2BE2"; </cfscript> <cfif IsDefined("ColorStruct")> <cfdump var="#ColorStruct#"> </cfif> </body> </html> More ColdFusion examples cfscript - if else conditional statement in script cfscript - switch, case, default statement in script cfw...

ColdFusion CFscript - If else statement in script

cfscript - if else conditional statement in script cfscriptIfElse.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>How to use if else conditional statement in cfscript tag</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">cfscript example: if else</h2> <hr width="350" align="left" color="PaleVioletRed" /> <br /> <cfform name="HelloForm" method="post"> Name: <cfinput type="text" name="UserName"> <cfinput name="Submit" type="submit" value="Submit"> </cfform> <br /> <cfscript> if (IsDefined("Form.Submit")) { if (Form.UserName neq "") { WriteOutput("Hello "); WriteOutp...

ColdFusion CFscript - Assign variable in script

cfscript - assign variable in script cfscriptAssignVariable.cfm <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cfscript tag: how to assign variable in cfscript tag</title> </head> <body> <h2 style="color:DodgerBlue; font-style:italic">cfscript tag example: assign variable</h2> <hr width="350" align="left" color="PaleVioletRed" /> <br /> <cfscript> firstNumber = 10; secondNumber = 5; sum = firstNumber+secondNumber; WriteOutput("<h3 style='color:Crimson; font-weight:bold'>"); WriteOutput("Sum of two numbers [10+5]: "); WriteOutput(sum); WriteOutput("</h3>"); </cfscript> </body> </html> More ColdFusion examples cftry and cfcatch - catch exception and handle...

ColdFusion CFscript: How to create an array in script

Introduction ColdFusion is a powerful and flexible platform for web development, offering a variety of ways to handle dynamic data, including arrays. Arrays are fundamental data structures in many programming languages, and ColdFusion's CFScript tag provides a JavaScript-like syntax for working with them. In this tutorial example, we explore how to create and manipulate arrays in CFScript, an approach that allows for more concise and readable code compared to traditional CFML. The example presented demonstrates how to initialize an array, append elements to it, and display its contents using ColdFusion's tools. Understanding how arrays work in CFScript will help streamline data management in your web applications, enabling more efficient handling of lists, collections, and sequences. Creating an Array in CFScript In this example, the ColdFusion ArrayNew() function is used to create an array within the CFScript block. This function initializes a new, empty array that can later ...

How to change menu static item hover style in asp.net c#

Static hover style in menu control The Menu is an ASP.NET web server control. Menu control's StaticHoverStyle property gets a reference to the style object that allows us to set the appearance of a static menu item when the mouse pointer is positioned over it. This property value type is System.Web.UI.WebControls.Style. This Style represents the style of a static menu item when the mouse pointer is positioned over it. The StaticHoverStyle property has a few sub-properties. we can set the property both declaratively and programmatically. The declarative syntax is Property-Subproperty and the programmatic syntax is Property.Subproperty (StaticHoverStyle.BackColor). So we can set the static menu item hover style as setting the background color, text color, border style, border width, font name, text size, etc. The following ASP.NET C# example code demonstrates to us how can we set or change the Menu control's static menu items hover style...

How to use cfdiv in ColdFusion

Introduction In web development, user interactions often require dynamic content updates without needing to reload the entire page. Adobe ColdFusion provides a useful tool for this through the cfdiv tag, which allows developers to refresh specific sections of a webpage asynchronously, improving user experience by reducing unnecessary page loads. This tutorial demonstrates how to use the cfdiv tag in ColdFusion, providing a simple form that takes user input and dynamically displays a response. This example comprises two main components: an HTML page that incorporates ColdFusion's cfdiv and cfform elements, and a separate ColdFusion file ( hello.cfm ) that processes user input and dynamically returns content based on it. By the end of this tutorial, you'll understand how to use cfdiv for smooth user interactions, powered by ColdFusion’s binding features. Structure of the Main HTML Page The main HTML page ( cfdiv.cfm ) forms the front-end of this example. It begins with a sta...

ColdFusion - How to catch exception and handle error

cftry and cfcatch - catch exception and handle error cftry.cfm <!DOCTYPE html"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cftry and cfcatch tag example: how to catch exception and handle error</title> </head> <body> <h2 style="color:DodgerBlue">ColdFusion cftry and cfcatch example</h2> <cftry> <!---Here i input wrong table name---> <cfquery name="qEmployee" datasource="cfdocexamples"> SELECT * FROM Employeess </cfquery> <cfdump var="#qEmployee#"> <cfcatch type="any"> <cfoutput> Error occured....<br /><br /> Message: <b>#cfcatch.Message#</b><br /> Detail: <b>#cfcatch.Detail#</b><br /> Type: <b>#c...

asp.net - Change TreeView root node style programmatically

Change TreeView root node style programmatically The TreeView is an asp.net web server control. The TreeView is located under System.Web.UI.WebControls namespace. TreeView web server control displays hierarchical data. Such as a table of contents in a tree structure. The following asp.net c# tutorial code demonstrates how we can programmatically change the TreeView web server control’s root node style. The asp.net c# developers can set the TreeView root node style using its RootNodeStyle property. The TreeView RootNodeStyle property gets a reference to the TreeNodeStyle object that allows us to set the appearance of the root node in the TreeView control. The TreeView RootNodeStyle property value is TreeNodeStyle which is a reference to the TreeNodeStyle that represents the style of a node in the TreeView. The TreeNodeStyle class represents the style of a node in the TreeView control. The TreeView RootNodeStyle property controls the de...

asp.net - Change TreeView node style programmatically

Change TreeView node style programmatically The TreeView is an asp.net web server control. The TreeView is located under System.Web.UI.WebControls namespace. TreeView web server control displays hierarchical data. Such as a table of contents in a tree structure. The following asp.net c# tutorial code demonstrates how we can programmatically change the TreeView web server control’s node style. The asp.net c# developers can set the TreeView node style using its NodeStyle property. The TreeView NodeStyle property gets a reference to the TreeNodeStyle object that allows us to set the default appearance of the nodes in the TreeView control. The TreeView NodeStyle property value is TreeNodeStyle which is a reference to the TreeNodeStyle that represents the default style of a node in TreeView. The TreeNodeStyle class represents the style of a node in the TreeView control. The TreeView NodeStyle property controls the default appearance of a nod...

asp.net - Change TreeView leaf node style programmatically

TreeView leaf node style programmatically The TreeView is an asp.net web server control. The TreeView is located under System.Web.UI.WebControls namespace. TreeView web server control displays hierarchical data. Such as a table of contents in a tree structure. The following asp.net c# tutorial code demonstrates how we can programmatically change the TreeView web server control’s leaf node style. The asp.net c# developers can set the TreeView leaf node style using its LeafNodeStyle property. The TreeView LeafNodeStyle property gets a reference to the TreeNodeStyle object that allows you to set the appearance of leaf nodes. The TreeView LeafNodeStyle property value is TreeNodeStyle which is a reference to the TreeNodeStyle that represents the style of the leaf nodes in the TreeView. The TreeNodeStyle class represents the style of a node in the TreeView control. The TreeView control allows us to specify different style characteristics such...