Posts

Jquery: replace character of select drop down values with other

below code snippet can be used to replace "-"  of select drop down values with ",". JQuery('#sel_test option:contains ("-")).each function(index,option)    {       var sval = JQuery(option).val().replace(/\-/g,",");       JQuery(option).val(sval);       JQuery(option).html(sval);     }

Jquery: how to validate time format HH:MM

There are many ways to validate HH:MM format. Below function also can be used to validate HH:MM format. function ValidateTime(value) {   var timepattern = /^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/;   if (value.match(timepattern ))     {        return true;     }  return false; }

how to validate UUID or transaction number format in ColdFusion

Below code can be used to validate a UUID format or a transaction number format in ColdFusion <cfset test=ReMatchNoCase('[a-z0-9{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}',value) />

ColdFusion isvalid for dd/mm/yyyy format

below isvalid code can be used for validating date with dd/mm/yyyy format <cfoutput>#isvalid("regex"," 02/28/2015","^(0[1-9]|[12][0- 9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d$")#</cfoutput>

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&