Posts

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...

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 >             <...

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>  ...

Collapsible Div

<script language="javascript"> function togglefun() {     var ele = document.getElementById("toggleText");     var text = document.getElementById("displayText");     if(ele.style.display == "block") {             ele.style.display = "none";         text.innerHTML = "[+]";       }     else {         ele.style.display = "block";         text.innerHTML = "[-]";     } } </script> <a id="displayText" href="javascript:togglefun();">[+]</a> Click here <div id="toggleText" style="display: none"><h1>Iam Collapsible Div</h1></div>

Email Validation in coldfusion

 <cfif isDefined("form.MailTo")>     <cfset valid = REFind("^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$", Trim(form.MailTo), 1) gt 0>     <cfif (form.MailTo NEQ 'Enter an email address') AND (form.MailTo NEQ '') AND (valid EQ 'YES')  >          <cfmail to = "#form.MailTo#" from = "xyz@mail.com" subject = "test"  type="text/html" >                   test             </cfmail>           <div ><h2>Email sent successfully!</h2><p>to:  <cfoutput>#form.MailTo#</cfoutput></p></div>     <cfelse>         <div ><h2>Email not sent. No valid email address supplied.</h2></di...

Coldfusion code to remove illegal characters

<cfset s="FFFFt frgrth @!$?BNBNMJK %^&*()  LÖÖҗҢџьлÖҗҢџьлÖҗҢџьлÖҗҢџьлJLUIOUIO">  <cfset a=REReplace(s, '[^\x00-\x7F]', ' ', "ALL")>  <cfoutput>#a#</cfoutput>

javascript Div pop up

<style type="text/css">     #popup      {         background-color:#111;         opacity: 0.65;         filter:alpha(opacity=65);         position:absolute;         z-index: 6001;         top:0px;         left:0px;         width:100%;      }     #popUpDiv      {         position:absolute;         background-color:#eeeeee;         width:300px;         height:300px;         z-index: 6002;     }    </style> <script type="text/javascript">  ...