All posts by Arvind Kumar

Autocomplete=”off” workaround / fix for valid XHTML

Add an onload function similar to the following to <head> section of your web page.

<script type="text/javascript">
function onload_call() {
if (!document.getElementById) return false;
var f = document.getElementById('field_name');
f.setAttribute("autocomplete", "off");
}
</script>

Continue reading

Customizing mysql query of a bound model

I had a hasAndBelongsToMany binding in my Charity Model as i normally would need all the “Causes” available along with Charity information and vice-versa. At one place i needed a specific number of “Causes” picked randomly from the database table. To make this work i had to add following two lines just before the $this->Charity->find call in my controller action:

$this->Charity->hasAndBelongsToMany['Cause']['limit']=5;
$this->Charity->hasAndBelongsToMany['Cause']['order']='rand()';

and i was done.

Does someone has a better solution? Please suggest.

Creating Ajax form in Cakephp (with Prototype.js)

(If you are using jQuery with cakephp you may want to view this article, Creating Ajax form in Cakephp using jQuery )

With the help of prototype/JavaScript we can build really cool and fully functional ajax form in CakePHP really fast.

I have been using the ajax forms in CakePHP for a long time now but in the view of continuous development work always on at CakePHP framework development community i have had to alter ways to write the same code. So here is the latest one. Continue reading

When Firebug made life easier

It’s been around three years now i have been using the Firebug. This great tool provides a web developer an easy way to look at and inspect the source code of a web page. You can view and experiment with each and every part of your web page and related DOM elements, inline or linked CSS, JavaScript and not to say the entire page content. Continue reading