Fix to jQuery plugin does not work on ajax loaded content

I had been loading table records through ajax pagination using jquery. Some of the urls/links (View Details, Edit and Delete) in loaded content had been using thickbox to handle respective requests. Although, if i did’t use the ajax to load records these links would work fine and thickbox would open. But once i introduced ajax they suddenly stopped working. ..read more

Posted in: Ajax, CakePHP, Javascript, jQuery  Post a commentNo Comments

Cakephp pagination and custom named arguments handling

Let’s have a look at the scenario first.

I have a “contacts” controller, a “display” action in it(controller) and a view “display.ctp” to show results. As normal my “display” action lists all the contacts by calling $this->set(‘contacts’, $this->paginate(‘Contact’)) inside the controller action “display”. The view works normal. ..read more

Posted in: CakePHP  Post a commentNo Comments

Calculating difference between two mysql dates in seconds

Here is a quick way to calculate the difference between two mysql dates in number of seconds. In my case, i required to fetch all entries for which the difference between current time stamp and date in a table field would be less than 5 minutes. ..read more

Posted in: MySQL  Post a commentNo Comments

Creating Ajax form in Cakephp using jQuery

Because of its being more flexible, extensible and precise nature the jQuery certainly has emerged as a more popular Javascript library as compared to prototype library. If you plan your Cakephp application depend heavily on Javascript, its right time to chose jQuery for your cakephp-cum-javascript needs. ..read more

Posted in: CakePHP, jQuery  Post a commentOne Comment

A note on DOM elements’ changed scope when using thickbox with jQuery

A similar situation may arise (atleast for me it did) when you try to invoke jQuery’s “thickbox” in conjunction with a custom onclick firing. I would explain it with the help of an example:

I have a div element (with id “myBlockTOShow”, i would say it “#myBlockTOShow” in this post further) which i display/present as a “thickbox” when a href tag/link is clicked. Here is how the div element looks like: ..read more

Posted in: jQuery  Post a commentNo Comments

Javascript common mistake of comparing with NaN and not with isNaN

Recently, i fell into the trap of NaN and isNaN and it turned me pulling my hair for quite a few good minutes. Thats why i decided to make a note of it here for a recitation and as a note of reference for myself for future. ..read more

Posted in: Javascript  Post a commentNo Comments

How to prevent parent’s onclick event from firing when a child tag is clicked with jquery?

Generally, Javascript events bubble (listen) to the highest point in the DOM at which a click event has been attached. So even if you don’t have any other explicitly clickable elements in the div, every child element of the div would bubble their click event up the DOM to until the DIV’s click event handler catches it. ..read more

Posted in: Javascript, jQuery  Post a commentNo Comments

Setting Style/CSS of select options using jQuery

This is how i set style (color here) of all of the options of a select list using jQuery.

In my case i had select options like this:

<select id=”select_list_id”>
<option value=”#595959″>Grey</option>
<option value=”#000000″>Black</option>
<option value=”#036″>Blue</option>
<option value=”#363″>Green</option>
<option value=”#632423″>Red</option>
<option value=”#403152″>Purple</option>
<option value=”#E36C0A”>Orange</option>
</select>

Follwoing the jQuery code i used to set color of options above:

  $(document).ready(function(){
	$('#select_list_id option', this).each(
		function ()	{
			$(this).css({'color':$(this).val()});
		}
	)
  });

Posted in: HTML and CSS, jQuery  Post a commentNo Comments

A note on setting up execution memory and time limits for php scripts

When executing large amount of data through php scripts it is common facing errors like “Fatal error: Maximum execution time of 300 seconds exceeded..”. Also, sometimes uploading large files through php scripts you might face errors like “The uploaded file exceeds the upload_max_filesize directive in php.ini..” etc. etc.. ..read more

Posted in: PHP  Post a commentNo Comments

Simple captcha component for CakePHP (New)

Referencing to an earlier post on CakePHP Captcha Component i.e. http://www.devarticles.in/cakephp/simple-captcha-component-for-cakephp which i had posted quite a few time ago. Recently i got chance to modify an available phpcaptcha script to suit the cakephp and it turned out to be more precised bit of code and not to say, very simple to install. ..read more

Posted in: CakePHP  Post a comment10 Comments