CakePHP: Validate dependent field (select dropdown + input field)

Posted July 15th, 2010 in CakePHP, PHP, Programming, Projects by Louie Miranda

Earlier this week, I was working on a project where I needed to validate two dependent fields.

< ?php echo input('office', array('type' => 'select', 'options' => $nd[0])); ?>
< ?php echo input('office_other', array('maxlength' => '255', 'size' => '35', 'label' => 'Other Office')); ?>

The “office” field is a select (drop down box) from my data array(). What I needed is to be able to add another data from a field and name it as “office_other” where it would initially capture and re-list again new offices if it does not exist.

Continue Reading »