protected static $_properties = array(
'id',
'name' => array( // Array defines column properties for use in forms and validation
'data_type' => 'varchar',
'label' => 'Business Name',
'form' => array('type' => 'text'),
'default' => 'New business',
'validation'=> array('required', 'min_length' => array(3)),
),
'category' => array(
'data_type' => 'integer',
'label' => 'Category',
'form' => array(
'type' => 'select'
),
),
'description' => array(
'data_type' => 'text',
'label' => 'Description',
'form' => array('type' => 'textarea'),
'validation'=> array('required', 'min_length' => array(25)),
)
);
Controller:
$edit_fields = Fieldset::forge('edit_business')
->add_model('Model_Business');
$cat_input = $edit_fields->field('category');
$cat_input->set_attribute(array('options' => array('3' => 'No value!')));
$edit_form = $edit_fields->form();
$edit_form->add('submit', '', array('type' => 'submit', 'value' => 'Submit'));
This was my guess but it didn't work, and only looked at the model. $edit_fields = Fieldset::forge('edit_business') ->add_model('Model_Business');
$edit_fields->field('category')->set_attribute(array('options' => array('3' => 'No value!')));
$edit_fields->add('submit', '', array('type' => 'submit', 'value' => 'Submit'));
// create the fieldset for the exam voucher
$voucherform = Fieldset::forge('voucherform');
$voucherform->add('voucher', 'Geef uw examen code in');
// create the fieldset for the payment method
$options = array('0' => '', 'IDEAL' => 'Betaal via iDEAL');
Auth::has_access('access.user') and $options['ACCOUNT'] = 'Op rekening';
$voucherform->add('methode', 'Gewenste betaal methode', array('type' => 'select', 'options' => $options));
Harro Verton wrote on Friday 27th of July 2012:From one of my apps:
// create the fieldset for the exam voucher $voucherform = Fieldset::forge('voucherform'); $voucherform->add('voucher', 'Geef uw examen code in'); // create the fieldset for the payment method $options = array('0' => '', 'IDEAL' => 'Betaal via iDEAL'); Auth::has_access('access.user') and $options['ACCOUNT'] = 'Op rekening'; $voucherform->add('methode', 'Gewenste betaal methode', array('type' => 'select', 'options' => $options));
It looks like you're new here. If you want to get involved, click one of these buttons!