Posted by Bharat Patel on December 31, 2009 |
|
Hello Friends,
Generally, In pop-up window has a minimize or maximize button but coldfusion cfwindow's has not it. We need to add after creating cfwindow. How can we done it? Have a look below code.
var objWin = ColdFusion.Window.getWindowObject("cfwindowname")
//always expand when opening a window
objWin.expand();
if (!objWin.collapseBtn){
objWin.collapseBtn = objWin.toolbox.createChild({
cls: "x-dlg-collapse"
});
//add a listener for the collapse click
objWin.collapseBtn.on("click",objWin.collapseClick,objWin);
//add the class to swap the image on mouse over
objWin.collapseBtn.addClassOnOver("x-dlg-collapse-over");
} Posted by Bharat Patel on December 31, 2009 |
|
Hello Friends,
CFWindow has attribute for giving title to window. Once it is created, we can use it multiple time for different purposes with same title otherwise we need to create it again if we want to change title. Using setTitle function there is no need to create again. We can just change window title name runtime. Have a look at code below.
var objWin = ColdFusion.Window.getWindowObject("cfwindow1");
objWin.setTitle('Change Title over here');
Posted by Bharat Patel on December 31, 2009 |
|
Hello Friends,
Coldfusion 8 has introduced cfwindow tag. It is used to create pop up window in browser without creating any separate browser window instance. cfwindow can be used in different ways.
1. CFWindow with local content.
<cfwindow name="cfwinpage" title="cfwindow1"> <h1>CFWindow with local content</h1> </cfwindow>
2. CFWindow with remote content.
<cfwindow name="remotecfwindow" title="cfwindow with remote content" source="remotewindow.cfm" />
3. CFWindow with JavaScript.
<script>
function init(){
ColdFusion.Window.create('cfWin','CF Window Example Using javascript','remotewindow.cfm',{x:100,y:100,height:400,weight:400});
}
</script>Posted by Akash Bavlecha on December 30, 2009 |
|
Here is a little code of looping over a file in coldfusion using CFLOOP.
Lets have a look.
<cfloop file="YourFilePath" index="line"> Your code goes on here... </cfloop>
<cfloop file="YourFilePath" index="chars" characters="6"> Your code goes on here.. </cfloop>
Posted by Bharat Patel on December 30, 2009 |
|
Hello Friends,
CFScript is a language in language. It is scripting language. We can write a code similar to JavaScript. It runs on the ColdFusion server. it does not run on the client system. We can use all coldfusion function and variables that are available in script's scope.
We can not use cfloop [Index,List,Collection,query] inside cfscript. Today, I have done how to use loop [Index,List,Collection,Query] in cfscript. I hope it may be helpful.
<!--- Index Loop --->
<cfscript>
writeOutput('<h3>Index Loop</h3><br />');
for(i=0; i<10; i++) {
writeOutput("Loop index is : #i# <br /> ");
}
</cfscript>
<!--- Collection Loop --->
<cfscript>
testStru = structNew();
testStru.firstname = "Bharat";
testStru.lastname = "Patel";
writeOutput('<h3>Collection Loop</h3><br />');
for(i in testStru) {
writeOutput("#i#[<b>#testStru[i]#</b>]<br>");
}
</cfscript>
<!--- List Loop --->
<cfscript>
TestList = 'Bharat,Pritesh,Naresh,Akash,Nirav';
writeOutput('<h3>List Loop</h3><br />');
for(i=1;i<=ListLen(TestList);i++){
value = ListGetAt(TestList,i);
writeOutPut('
#value#<br />
');
}
</cfscript>
<!--- Query Loop --->
<cfquery name="qArt" datasource="cfartgallery">
SELECT *
FROM Artists
WHERE 1 = 1
</cfquery>
<cfscript>
writeOutput('<h3>Query Loop</h3><br />');
for(i=1;i<=qArt.recordCount;i++){
writeOutput(
'<b>ArtistId</b> : '
& qArt[ 'ArtistId' ][ i ]
& ' <b>FirstName</b> : ' & qArt.Firstname[i]
& ' <b>LastName</b> : ' & qArt['Lastname'][i]
& '<br />'
);
}
</cfscript>Posted by Akash Bavlecha on December 29, 2009 |
|
Coldfusion has a beauty and that is CFDUMP. But very few of CFers know about enhancements made in CFDUMP that provides control over what to show and what not to in a dump result. It has many new enhancements.
Posted by Bharat Patel on December 28, 2009 |
|
Hello Friends,
In coldfusion programming we need to use javascript any time. We can easily do this. We can not write directly javascript in CFSCRIPT tag. There is one way to write javascript in CFSCRIPT tag. Look below code. I hope you may find it interesting.
<cfscript>
WriteOutput('
<script language="JavaScript">
str = confirm("Do you like the cfscript tag?");
if (str == true)
alert("Yes, I like it.");
else if (str == false)
alert("No, I do not like.");
</script>
');
</cfscript>
<cfscript>
WriteOutput('
<h1>Html using cfscript</h1>
');
</cfscript>
Posted by Bharat Patel on December 26, 2009 |
|
Hello Friends,
Very often we need to check or uncheck check boxes at single click using js. If we are using javascript then we have to loop over an array to do so but by below example its been more easy and simple to use it.
Now Using jQuery we can easily do it and thats why i love it. we need only few lines of code for check or uncheck check boxes.
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script>google.load("jquery", "1.3.2");</script>
<script>
jQuery(function(){
jQuery('#checkAll').click(function(){
var status = jQuery(this).attr('checked');
jQuery('input[name=checkOne]').each(function(){
this.checked = status;
}
});
});
</script>
1. Name and id of main checkbox.
2. Name of all checkboxes has to be checked.
I hope you may like it.
Posted by Bharat Patel on December 25, 2009 |
|
Hello Friends,
Developer guidance,
The online Ajax Api libraries by google most popular open source javascript libraries. If you want to use jQuery using google api then you have to write only below code in your web page.
<script src="http://www.google.com/jsapi"></script>
<script>google.load("jquery", "1.3.2");</script>
And More....
google.load("jquery", "1.3.2");
google.load("jqueryui", "1.7.2");
google.load("prototype", "1.6.1.0");
google.load("scriptaculous", "1.8.3");
google.load("mootools", "1.2.4");
google.load("dojo", "1.4.0");
google.load("swfobject", "2.2");
google.load("yui", "2.8.0r4");
google.load("ext-core", "3.0.0");
Click here to more detail...
Posted by Naresh Patel on December 25, 2009 |
|
Hi,
I have created a sample Flex application that uses HorizontalList
component.
Now when I use dynamic dataprovider that is if data to display is
dynamic the HorizontalList component is working.
My code for the sample app is as under:
image.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Image;
import com.events.MainButtonClickEvent;
public function cmdOpen_click(event:Event):void
{
if(grdResource.selectedIndex >= 0)
{
var ImageURL:URLRequest = new URLRequest();
ImageURL.url = grdResource.selectedItem.typeValue;
navigateToURL(ImageURL,"_blank");
}
else
Alert.show("Please select Image to open");
}
private function getResourceByProducts_result(event:ResultEvent):void
{
this.grdResource.dataProvider = new ArrayCollection(event.result.source as Array);
}
private function server_fault(event:FaultEvent):void
{
Alert.show(ObjectUtil.toString(event.fault));
}
]]>
</mx:Script>
<mx:RemoteObject
id="rdoImageResource" destination="ColdFusion"
source="Myapplication.coldfusion.Images.ImagesResourceGateway">
<mx:method name="getResourceByImages" result="getResourceByImages_result(event)" fault="server_fault(event)"/>
</mx:RemoteObject>
<mx:HorizontalList id="grdResource" iconField="thumbnailImage" columnCount="6" columnWidth="135" rowCount="1" rowHeight="135"
horizontalScrollPolicy="on" x="20" y="698" width="698" click="cmdOpen_click(null)" visible="false">
<mx:itemRenderer>
<mx:Component>
<mx:VBox horizontalAlign="center">
<mx:Label text="{data.reference}" id="test1" />
<mx:Image source="{data.imagename}" id="image" height="100" width="115" />
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:HorizontalList>
</mx:Application>
Recent Comments