I have the following in the form.php:
$color->output('color', $color, array('showAlpha' => 'false'));
echo $form->select('font', $fonts, $font_selected);
and controller.php:
edit(){
$this->set('font', $font); // $font - user selected font
$this->set('fonts', $fonts); // $fonts - array of available fonts
$this->set('color', 'rgb(0, 0, 0)');
}
save() {
$args['color'] = isset($args['color']) ? trim($args['color']) : 'rgb(0, 0, 0)';
$args['font'] = isset($args['font']) ? trim($args['font']) : '';
}
- How can I pass color to the form widget? With $color in there, it fails to open the form (must be throwing an uncaught exception). If I change $color to '', the form opens, but the color is obviously not set.
- How can I save the selected font value, not the index? The $args['font'] saves the selected index only, not the option text value.
Thank you.