Posts

Showing posts from December, 2012

Coldfusion Code to disable a button

<cfparam name="form.h1" default="0"> <cfif isdefined('form.h1') AND form.h1 EQ 1>     <cfoutput>The button is disabled when you submitted the form</cfoutput> </cfif> <cfform onsubmit="document.getElementById('s1').disabled = 1;" action="#cgi.SCRIPT_NAME#?#cgi.QUERY_STRING#">     <cfinput type="text" name="t1" id="t1"><br>     <cfinput type="text" name="t2" id="t2">     <cfinput type="hidden" name="h1" id="h1" value="1">     <cfinput type="submit" name="s1" id="s1" value="submit"> </cfform>

hash mismatch error while web service call in ColdFusion

These issue occurs since ColdFusion Hash function returned output and the output from PHP will be different in their case (Lower/upper). So for fixing these issues, we have to convert both of them to the same case. for example, we can use the LCase method of ColdFusion to change the hash output to lowercase before passing it to the web service call <cfset hashvalue_test=Hash(#hashvalue_test#,"MD5")> <cfset hashvalue_test=LCase(hashvalue_test)>

Coldfusion Code to get the mail attachments for unread mails using cfimap

The following code opens a connection 'Conn' using cfimap for the given username and password. Also it fetches the unread emails with attachments.  <cfimap action="open" connection="Conn" server="imap.gmail.com" username="test@gmail.com" password="test" secure="yes" > <cfimap action="getall" connection="Conn" name="Query_getAttachments" folder="Inbox" attachmentpath="#GetTempDirectory()#"  > <cfquery dbtype="query" name="getMailAttachments">       select * from Query_getAttachments       where seen=<cfqueryparam value="no" cfsqltype="cf_sql_varchar">       and ATTACHMENTS is not null </cfquery> <cfdump var="#getMailAttachments#"> also if we want to copy the mail attachment from the Temp folder to our server folder, we can use cffile action="copy" or cffile action

Script to Disable multiple Checkboxes with ColdFusion

<html> <head> <script type="text/javascript"> function toggleGroup(id) {     var group = document.getElementById(id);     var inputs = group.getElementsByTagName("input");     for (var i = 0; i < inputs.length; i++) {         inputs[i].disabled = (inputs[i].disabled) ? false : true;     }     } window.onload = function() { document.getElementById("checkmain").onchange = function() {    toggleGroup("check_grp");    } } </script> </head> <body>  <cfform name="form1" >     <cfinput type="checkbox" name="checkmain" id="checkmain" />Enable/Disable<br />     <p id="check_grp">          <input type="checkbox" /><label for="check1">check 1</label>          <input type="checkbox"  /><label for="check2">check 2</label>          <input type=&q

JqueryMobile Back Button is not working

For fixing the issue of Back Button in JqueryMobile, we can use the following script. <script>             $.extend(  $.mobile , {             ajaxEnabled         : false,             hashListeningEnabled: false             });  </script>