CakePHP Validation Nightmare

So I had this form with radio buttons and some database fields that do not allow NULLS which was working before I started tinkering with some fancy features.

After a few minutes of modifying the code to use a JQuery star rating plugin for the radio buttons, I was stuck with a form that wouldn’t save even though the validates $this->ModelName->validates(array('fieldList'=>array())) method returned true.

Printing out the posted data in $this->data showed me that my radio buttons which were created individually were sending empty strings with no data.

I was almost knocking my head against the wall and pulling out my hair when I decided to turn off the validation for the radio button fields just to see if that would make the form save. But no joy!

Eventually, by using Firefox‘s webdeveloper plugin I examined the form and noticed there was one hidden input with the name of the radio button field for each of the radio buttons.

How do I remove these hidden input fields? According to the CakePHP manual, a hidden field is usually attached to form elements such as radio buttons, and check boxes, so that even when none of the options get selected, there will be an entry for that field in the return $this->data array.

Then I found out from the manual that you can remove the hidden fields by specifying an option for ‘hiddenField’=>false as part of added parameters for the form input method.

I removed all the hidden fields from all but the very first radio button just to keep things normal. That means I specified ‘hiddenField’=>false for each radio button excluding the first one in the group.

This meant that my form now submitted data normally in each of the radio button groups.

But despite fixing this there was still a problem as my database only saved some fields and ignored the other form fields. I quickly realised that I had whitelisted several fields and forgot to add the news fields I had added when I modified the database structure.

That solved the problem of the partial saving altogether.

Finally, I decided to allow NULLS for the fields that were allowed to be empty in order to ensure that it saves even when none of the radio button options are selected which was what I needed.

Goodness gracious!


TweeetDeck Crashes Anytime a Popup Notification Shows

I used to have this problem with tweetdeck anytime a popup notification appeared on my windows XP machine.

Tweet deck would suddenly crash and windows would report an error has occurred.

After searching Google for a solution I couldn’t find any joy until I realised I had an old outdated version of Adobe Air installed.

I also had a LameAcm codec that caused some problems with the sound.

All I had to do was uninstall the Adobe air, download and reinstall the latest version of adobe air, and that fixed the crashing problem.

Map an Existing Domain — Support —

On, you can use a domain that you already own, such as, instead of your blog’s default address, like This is called Domain Mapping. Your old address will still work, but we will automatically redirect traffic from your old address to your new one.

Domain Mapping is a paid upgrade that costs $13.00 per domain, per blog, per year. You can map as many domains as you want to one blog, but you have to pay for each domain separately.

The Domain Mapping Upgrade does not enable the permission to use advertising, any kind of prohibited code, or upload additional themes or plugins. With the upgrade, your blog will still be hosted here at, which means that you will not have FTP access to your files and you will still be required abide by the Terms of Service.

Instructions for Mapping an Existing Domain

  1. Update your domain’s name servers to the following. Make sure to remove any existing name servers that are already there.


    You can usually change your domain’s name servers at your registrar’s website, but the process is different for each domain registrar. Instructions for popular registrars are available here— if your registrar isn’t listed, visit their website or contact their support team for assistance.For certain domains, such as and other non-US domains (or ccTLDs), your registrar may require us to add a “Zone Record” on the servers before the name servers can be updated. Please contact supportand state the domain you want to map, and we’ll take care of this for you.

    Domain Mapping for IDNs, also known as Internationalized Domain Names, is currently not supported on sites. (Your domain name is an IDN if it contains language-specific characters such as ä, û, ע, ж, 字, मा.)

    If your registrar needs the IP addresses of the Name Servers, you can use the following. However, note that IP addresses are subject to change and using the full domain name is preferred.

    When a new domain is purchased or when name servers are updated, it can take some time for the change to take full effect (up to 72 hours, but normally much less).

    Warning: when you change the name servers, any custom DNS records such as A, CNAME, or MX records will stop working. Specifically, this can mean that any email addresses you have on this domain (such as may stop working once the mapping is complete. To continue using them, you’ll need to enter new Custom DNS records once you have set up your domain on We recommend you prepare the relevant information in advance, before you start the domain mapping. Alternatively, you can map to a subdomain, which doesn’t require changing the name servers and will not effect any custom DNS records.

  2. After the name server change takes effect, go to Store -> Domains in your blog’s dashboard, enter the domain into the form at the top of the page, and click the Add domain to blog button. If the name servers are verified, you will be prompted to pay for the upgrade and complete the process.
  3. After the purchase is complete, go to the Settings -> Domains page, select the radio button next to the domain you just mapped to your blog, and click the Update Primary Domain button.

from Map an Existing Domain — Support —

Content SPAM – How Do I Prevent Spammers?

I just logged into my dashboard for a social platform I built using CakePHP.
Unceremoniously, I noticed that today I had so many feedbacks and comments.
Now having feedbacks and comments on your site seems like a good thing and sort of gives an impression that you are gaining traffic.

However, when these comments and feedbacks are totally useless and have no relation with the content you have published, then that’s certainly not a good thing.

Normally, I would have placed a CAPTCHA verification box for every public form, but I am of the opinion that using a CAPTCHA is somewhat repulsive to some people.

After pondering for a moment on how to implement a realistic and non-obtrusive verification, I decided it would be best to allow comments and content from registered users only, as well as keep the feedback form open, with a script to filter out spam content.

Oh Blimey!!! My Tests Didn’t Catch This Case

The other day I committed a very grave error, one that should never be heard of.
I had this application I had written a couple of years back when I was just getting introduced to MVC frameworks and the methodology.
SO what did I do wrong? Imagine a portal where you make purchases online. Then imagine a cart with just one item and the price that the user will be paying.
Now imagine this, I did a pre-validation on the amount before the user sees the confirm transaction button.
But right in my code, I didn’t check verify that the customer had sufficient credit to complete the transaction.

Funny, this went unnoticed for over 3 years and I just discovered it when I saw two customers with a negative balance and received a complaint from one of them about the transaction from the unverified link.

Would I have detected this with Unit testing? What other methods of testing would catch this sort of buggy implementation?
Let me know what you think…

A friend of mine Sola Ajayi who has deployed an eLibrary using JQuery Mobile just posted this short guide on creating a mobile app with JQuery mobile.

Little Drops of Words

By popular demand, I’ve been working on several mobile applications in the last couple of months. I’ve come to love jQuery Mobile (jQM) for it’s simplicity and ease-of-use. I also love the rich UI components, tools that make creating apps easy, much more. A super cool friend, Adegbenga Agoro, asked for a short introduction to jQM and this post is a result of that intro. This is a sharp-sharp (Nigerian slang for quick) introduction to jQuery mobile. It showcases my favorite tools and resources for working with jQM.

Where to start? It’s got everything. Demos, docs, tips, device compatibility etc.

Tools & Tips

jQuery Themeroller

Create Theme Swatches for jQuery Mobile Interface. Allows d rag and drop of colors to UI components.Update existing themes by importing css. Allows export of themes in css format & includes icons.

Mobile Apps > PhoneGap

Want to great Mobile Apps? Compile…

View original post 75 more words