Tuesday, July 16, 2013

Form Helper - Checkboxes

I am fairly new to cake, and this is actually the first time I have  needed to use checkboxes. Here is a screen capture of my form and you will notice that there are multiple checkboxes.  I am only able to check the boxes that show a checkmarks.  The common denominator appears to be any box that is followed by another is functioning, any box that is not followed by another box is not functioning.   I have included my form code below...What the heck am I doing wrong?


<div class="audits form">
<?php echo $this->Form->create('Audit');
echo $this->Session->flash();
//print_r($customers);
?>
    <fieldset>
        <legend><?php echo __('Add Customer'); ?></legend>
    <?php
        echo $this->Form->input('Customer.first_name', array('label' => 'First Name'));
        echo $this->Form->input('Customer.last_name', array('label' => 'Last Name'));
        echo $this->Form->input('Customer.address');
        echo $this->Form->input('Customer.city');
        echo $this->Form->input('Customer.state');
        echo $this->Form->input('Customer.zip', array('label' => 'Zip Code'));
        echo $this->Form->input('Customer.email');
        echo $this->Form->input('Customer.phone');
        echo '</fieldset>';
        echo '<fieldset>';
        echo '<legend>Add Audit:</legend>';
        echo $this->Form->input('additional_insulation', array('type' => 'checkbox','label' => 'Additional Insulation Needed?','value' => '1','hiddenField' => '0',));
        echo $this->Form->input('radiant_barrier', array('type' => 'checkbox','label' => 'Radient Barrier Present?','value' => '1','hiddenField' => '0',));
        echo $this->Form->input('attic_square_footage');
        echo $this->Form->input('roof_deck_square_footage');
        echo $this->Form->input('soffit_vents', array('type' => 'checkbox','label' => 'Soffit Vents Needed?','value' => '1','hiddenField' => '0',));
        echo $this->Form->input('number_of_soffits_needed', array('value'=> '0'));
        echo $this->Form->input('insulated_outlet_covers', array('type' => 'checkbox','label' => 'Insulated Exterior Outlets?','value' => '1','hiddenField' => '0',));
        echo $this->Form->input('number_exterior_outlets', array('value'=>'0'));
        echo $this->Form->input('programmable_thermostat', array('type' => 'checkbox','label' => 'Is the thermostat programmable?','value' => '1','hiddenField' => '0',));
        echo $this->Form->input('water_heater_blanket', array('type' => 'checkbox','label' => 'Is there a water heater blanket?','value' => '1','hiddenField' => '0',));
        echo $this->Form->input('water_heater_pipe_wrap', array('type' => 'checkbox','label' => 'Does the water heater pipe need insulation?','value' => '1','hiddenField' => '0',));
        echo $this->Form->input('window_film', array('type' => 'checkbox','label' => 'Are the windows insulated?','value' => '1','hiddenField' => '0',));
        echo $this->Form->input('number_of_windows', array('value'=>'0'));
        echo $this->Form->input('insulated_doors', array('type' => 'checkbox','label' => 'Are the doors insulated?','value' => '1','hiddenField' => '0',));
        echo $this->Form->input('number_of_doors', array('value'=>'0'));
        echo $this->Form->input('garage_door_insulation', array('type' => 'checkbox','label' => 'Is the garage door insulated?','value' => '1','hiddenField' => '0',));
        echo $this->Form->input('garage_door_size', array('label' => 'How many single garage panels?','options' => array(1, 2, 3, 4, 5), 'empty' => '(choose one)'));
        echo $this->Form->input('crawl_space_insulation', array('type' => 'checkbox','label' => 'Is the crawl space insulated?','value' => '1','hiddenField' => '0',));
        echo $this->Form->input('crawl_space_square_footage');
        echo $this->Form->input('energy_saver_box', array('type' => 'checkbox','label' => 'Is there an energy saving box?','value' => '1','hiddenField' => '0',));
        echo $this->Form->input('average_energy_bill');
    ?>
    </fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: