2
嗯我寫了表單fields.But常見bootstrap css也適用於隱藏字段也如何限制隱藏字段在cakephp 3.x bootstrap。cakephp 3.0隱藏領域bootstrap問題
$myTemplates = [
//'nestingLabel' => '<label{{attrs}}>{{text}}</label>{{input}}{{hidden}}',
'inputContainer' => '<div class="form-group order-status">{{content}}</div>',
'checkboxContainer' => '<div class="checkbox">{{content}}</div>',
'label' => '<label class="col-sm-2">{{text}}</label>',
'input' => '<div class="col-md-3"><input type="{{type}}" name="{{name}}" class="form-control" {{attrs}} /></div>',
'select' => '<div class="col-md-3"><select name="{{name}}"{{attrs}} class="form-control">{{content}}</select></div>',
'textarea'=> '<div class="col-md-8"><textarea name="{{name}}" {{attrs}} class="form-control"></textarea></div>',
];
$this->Form->templates($myTemplates);?>
<fieldset>
<legend><?php echo __('{0} Promotion', $edit ? 'Edit' : 'Add'); ?></legend>
<?php
if($edit) {
echo $this->Form->hidden('id');
echo $this->Form->input('active', array('type' => 'checkbox','div'=>false));
} else {
echo $this->Form->input('active', array('type' => 'checkbox','checked' => true));
}
echo $this->Form->input('name');
echo $this->Form->input('description');
if($edit) {
echo $this->Form->input('promotion_type', array('type' => 'select', 'options' => Configure::read('Sidecart.ModelOptions.Promotion.promotion_types'), 'empty' => '-- Select One --', 'disabled' => true));
echo $this->Form->hidden('promotion_type');
} else {
echo $this->Form->input('promotion_type', array('type' => 'select', 'options' => Configure::read('Sidecart.ModelOptions.Promotion.promotion_types'), 'empty' => '-- Select One --'));
}
?>