'form_template' => "\n\t\t{open}{fields}{close}\n\t\t", 'fieldset_template' => "\n\t\t{open}{fields}{close}\n\t\t", 'field_template' => "\n\t\t<span class=\"field\">{label}{required}{field}</span>",As I wasn't keen on the <table> approach.
$forms = Form::open(Array('action' => Uri::create('auth/create'), 'method' => 'post')); $forms .= Form::fieldset_open(Array('class' => 'entry-form', 'id' => 'create-client'), 'Create Client'); $forms .= Fieldset::forge('create_client')->add_model('Model_Client')->build(); $forms .= Form::button(Array('value' => 'Create', 'class' => 'btn primary large')); $forms .= Form::fieldset_close(); // above Fieldset_open blah blah * 5 $forms .= Form::close();
return array( 'default' => array( 'prep_value' => true, 'auto_id' => true, 'auto_id_prefix' => 'form_', 'form_method' => 'post', 'form_template' => "\n\t\t{open}\n\t\t<table>\n{fields}\n\t\t</table>\n\t\t{close}\n", 'fieldset_template' => "\n\t\t<tr><td colspan=\"2\">{open}<table>\n{fields}</table></td></tr>\n\t\t{close}\n", 'field_template' => "\t\t<tr>\n\t\t\t<td class=\"{error_class}\">{label}{required}</td>\n\t\t\t<td class=\"{error_class}\">{field} <span>{description}</span> {error_msg}</td>\n\t\t</tr>\n", 'multi_field_template' => "\t\t<tr>\n\t\t\t<td class=\"{error_class}\">{group_label}{required}</td>\n\t\t\t<td class=\"{error_class}\">{fields}\n\t\t\t\t{field} {label}<br />\n{fields}<span>{description}</span>\t\t\t{error_msg}\n\t\t\t</td>\n\t\t</tr>\n", 'error_template' => '<span>{error_msg}</span>', 'required_mark' => '*', 'inline_errors' => false, 'error_class' => 'validation_error', ), );you can then add as many as you want. My form definitions are specific for my applications and the way I work with errors and CSS, so I don't think that is very useful. To remove the form from the definition, simply use
'form_template' => "\n\t\t<table>\n{fields}\n\t\t</table>\n",so remove the open and close tags.
// I use a config file called forms.php which is autoloaded into the forms group $forms .= Fieldset::forge('create_client')->add_model('Model_Client')->set_config(Config::get('forms.embedded')->build();
It looks like you're new here. If you want to get involved, click one of these buttons!