Posts

onblur infinite alert issue fix

Issue: Infinte alert pop up when you use onblur event. This issue have been monitored in Safari, IE. Root Cause: Each time clicking on 'Ok' button of the alert, onblur happens and we are trapped in an infinite loop. Fix: You can refocus the control to different element in the form to get rid off an infinite alert pop up due to onblur  event usage in your application Sample code given below <script type="text/javascript"> function validate() { if(document.getElementById('txtval').value != " ") { alert("not valid value"); document.getElementById('txtint').focus(); } } </script> <form> <input type="text" id="txtval"  name="txtval" onblur="validate();"> <input type="text" name="txtint" id="txtint" > </form> Note:I faced this issue in Safari browser here, but i remember same issue i have been

Pagination with next and previous links in ColdFusion

The following code gives pagination output with 'next' and 'previous' links. <cfparam name="FirstRow" default="1"> <cfparam name="DispRecords" default="5"> <cfquery name="GetParks" datasource="cfdocexamples" >      SELECT PARKNAME, REGION, STATE      FROM Parks </cfquery> <cfset EndRow=FirstRow + DispRecords> <cfif FirstRow + DispRecords GREATER THAN GetParks.RecordCount>     <cfset EndRow=999> <cfelse>     <cfset EndRow=DispRecords> </cfif> <table border="1">    <tr>       <th>NO.</th>       <th>PARKNAME</th>       <th>REGION </th>       <th>STATE</th>          </tr> <cfoutput query="GetParks" startrow="#FirstRow#" maxrows="#EndRow#">  <tr>       <td>#CurrentRow#</td>  

ColdFusion code for pagination using numbers

We can do pagination of results in many ways. Here the following code gives the pagination output using numbers with ColdFusion. <cfparam name="URL.PageId" default="0"> <cfset RecordsPerPage = 5> <cfquery name="GetParks" datasource="cfdocexamples" >      SELECT PARKNAME, REGION, STATE      FROM Parks </cfquery> <cfset TotalPages = (GetParks.Recordcount/RecordsPerPage)-1> <cfset StartRow = (URL.PageId*RecordsPerPage)+1> <cfset EndRow = StartRow+RecordsPerPage-1> <cfoutput> <table border="1">    <tr>       <th>No.</th>       <th>PARKNAME</th>       <th>REGION </th>       <th>STATE</th>    </tr>    <cfloop query="GetParks">   <cfif CurrentRow gte StartRow >      <tr>         <td>#CurrentRow#</td>         <td>#PARKNAME#</td>         <td&

Advantages of using hidden fields in ColdFusion

Hidden form fields can be used in a good way for avoiding the spambots.  Spambots  are automated computer programs designed to assist in the sending of spam. If we have a hidden field in the form, user cannot fill the hidden field, but the spambots can do fill the hidden fields. So for avoiding this, we can have a hidden field say, <cfinput type="hidden" name="spm_inputcheck" value=" "> and we can have a condition like: <cfif form.spm_inputcheck is " ">     perform the actions.. <cfelse>     abort </cfif>

Progress bar for scrolling using JQuery

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script> $(document).ready(function () {     $(window).scroll(function () {         var top = $(this).scrollTop(),             sheight = $(document).height(),             scrll = (top / sheight);         var position = (scrll)*100;             $("#progress_bar").attr('value', position);      });  }); </script> <progress id="progress_bar" value="0" max="80" style="position:fixed; top:15px;" ></progress> <br /><br /><br /> text1<br /><br /> text2<br /><br /> text3<br /><br /> text4<br /><br /> text5<br /><br /> text1<br /><br /> text2<br /><br /> text3<br /><br /> text4<br /><br /> text5<br /><br /> text1<br /><br /> text2<br /><br

Jquery Mobile Dialogue box closes automatically

In Some of the browsers, jquery mobile dialogue box will close automatically without clicking on the close button. For fixing the same issue, we can set a timeout so that it won't close automatically. for example, we can set the timeout using the code: $(document).ready(function () {    setTimeout(function () {     $.mobile.changePage('#errorDialog', { transition: 'pop', role: 'dialog' }); }, 100); }); Code example: <link rel=stylesheet href=http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css /> <script src=http://code.jquery.com/jquery-1.6.min.js></script> <script src=http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js> </script> <script type="text/javascript"> $(document).ready(function () {    setTimeout(function () {     $.mobile.changePage('#errorDialog', { transition: 'pop', role: 'dialog' }); }, 100); }); </script> </head>  <bo

Fixing Cyrillic Character issue in coldfusion

For fixing cyrillic character issues, we can use the ways given below: way 1:  Keep <cfprocessingdirective pageenc oding = "utf-8"> line so that issue will get resolved. For example, <cfcomponent displayname="testCyrillic" hint="Replace special characters"> <!---To Fix Cyrillic character issue : starts---> <cfprocessingdirective pageencoding = "utf-8"> Way 2:  Create jdbc datasource and add use Unicode=yes&charactorEncoding=UTF-8 with JDBC URL. Driver class as usual:  com.mysql.jdbc.Driver For example, jdbc:mysql:// localhost:3306/mySite? useUnicode=yes& charactorEncoding=UTF-8