Posts

Showing posts from October, 2012

Ajax Example in coldfusion

<script type="text/javascript">     function showvalues(str)     {         var xmlhttp;            if (window.XMLHttpRequest)           {// code for IE7+, Firefox, Chrome, Opera, Safari               xmlhttp=new XMLHttpRequest();           }         else          {// code for IE6, IE5               xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");            }         xmlhttp.onreadystatechange=function()           {           if (xmlhttp.readyState==4 && xmlhttp.status==200)                 {                     document.getElementById("txtHint").innerHTML=xmlhttp.responseText;                 }         }         xmlhttp.open("GET","?city_name="+str,true);         xmlhttp.send();     } </script> <cfparam name="url.city_name" default=""> <div id="txtHint">City info will be listed here...     <cfform>         <cfselect id="city_name"

Function to Convert the first letter of a string to Capital in coldfusion

<cfform>       Enter the String: <cfinput type="text" name="strUcase">       <cfinput type="submit" name="btn_ucase" value="Submit"> </cfform> <cfif isdefined ('form.btn_ucase')>       <cfinvoke method="CapFirst" returnvariable="str1">       <cfinvokeargument name="str" value="#form.strUcase#">       </cfinvoke>       <cfoutput>Converted String is: #str1#</cfoutput> </cfif>     <cffunction name="CapFirst" returntype="string" output="false">     <cfargument name="str" type="string" required="true" />         <cfset var newstr = "" />       <cfif Len (str) GTE 1 >             <cfset newstr = UCase ( left (arguments.str,1)) & Right (arguments.str, Len (arguments.str)-1)>       </c

Query to XML and XML to query in coldfusion

<!--- Query To XML, apart from xml packet creation, this will create a new  myDoc.xml file :start---> <cfquery name="empdetails" datasource="empdetails">     select empid,empname,empage,country,state,empsalary from empdetails </cfquery> <cfxml variable="xmlPacket">       <employees>         <cfoutput query="empdetails">             <employee id="#empid#">                                   <address>                     <empname>#empname#</empname>                     <empcountry>#country#</empcountry>                     <empstate>#state#</empstate>                 </address>                 <other>                     <empage>#empage#</empage>                     <empsalary>#empsalary#</empsalary>                 </other>             </employee>         </cfoutput>     </employ