0
votes

I am new to cakephp framework and i am using cakephp3.0 now i used baking concept instead of using scaffolding. After baking it automatically generated all pages based on my tables in database and it generated code in models,controllers and views.Now my question is "if it is possible to change the code in views to change field types (from text box to radio button) according to my requirements."

Please help me.

Thanks in advance

1
If you are new, it might be wiser to use a stable and well documented version: Cake2.x: book.cakephp.org/2.0/en/index.html - mark

1 Answers

0
votes

Yes, after you bake your project you can change the fields types. Navigate to the folder where all your views are located, for example: app\View\MyViewName. Baking is a great tool to get something up and running fast. If you have a fairly structured website mostly used for data entry this is a great tool. I used it for simple data entry websites and it has saved me so much typing! Just add some data validation/constraints in the model and you're good to go!

A freshly baked view will look a little something like this:

<div class="MyForm Form">
<?php echo $this->Form->create('MyForm'); ?>
    <fieldset>
        <legend><?php echo __('Add My Form'); ?></legend>
    <?php
        echo $this->Form->input('field1');
        echo $this->Form->input('field2');
    ?>
    </fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>
<div class="actions">
    <h3><?php echo __('Actions'); ?></h3>
    <ul>

        <li><?php echo $this->Html->link(__('List My Forms'), array('action' => 'index')); ?></li>
    </ul>
</div>

Change the input methods to look something like this:

$options = array('Y' => 'Yes', 'N' => 'No'); 
echo $this->Form->radio('myFields', $options);