This repository has been archived by the owner on Jun 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 297
Field list
Felice Ostuni edited this page Sep 21, 2015
·
21 revisions
You can (must) add fields to your DataEdit / DataForm so:
- text (input field)
$form->add('title','Title', 'text'); //field name, label, type
//short syntax
$form->text('title','Title'); //field name, label
- checkbox, usually used to work with a boolean 0-1 value, but it can be configured on different values (to be usable also for enum fields)
$edit->add('public','Public','checkbox');
//short syntax
$edit->checkbox('title','Title'); //field name, label
- checkboxgroup (checkbox list), usually using relation.fieldname to store values in a pivot table, for a belongsTo relation
$edit->add('categories','Categories','checkboxgroup')
->options(Category::lists("name", "category_id")->all());
- radiogroup, as checkboxgroup you can use option, options() to fill values
$edit->add('gender','Gender','radiogroup')
->option('F','Female')->option('M','Male');
- textarea (textarea field)
$form->add('body','Body', 'textarea')->rule('required'); //validation
- redactor (textarea rendered as wysiwyg via redactor mit lic. version 7.6.1 old but good)
$form->add('body','Body', 'redactor');
- file upload field, use move(path, [filename]) to change filename and destination
$edit->add('download','Attachment', 'file')->rule('mimes:pdf')->move('uploads/pdf/');
- image (file field with some image utils bundled using intervention image: preview, resize, crop, ...
$form->add('photo','Photo', 'image')->move('uploads/images/')->preview(80,80);
- autocomplete (input field with autocomplete feature using twitter typeahead and ajax features using relation.fieldname and search() method
$form->add('author.fullname','Author','autocomplete')
->search(array('firstname','lastname'));
- tags (input field with multiple autocomplete feature, using twitter typeahead and TagsInput
$form->add('categories.name','Categories','tags');
- colorpicker (input field with colorpicker for hex values bootstrap-colorpicker)
$form->add('color','Color','colorpicker');
- date: simple date field (https://github.com/eternicode/bootstrap-datepicker/) it support many locale (ie: 'it','en','de' complete list), and some format (ie: 'm/d/Y', 'd.m.Y', etc. you can use only "m","d","Y" for now).
$form->add('publication_date','pub.date','date')->format('d/m/Y', 'it');
- daterange: two date field that works together to make a WHERE BETWEEN, to be used on filters. it support some local & format like date field
$filter->add('publication_date','pub.date','daterange')->format('d/m/Y', 'it');
- auto: a simple way to pass values to your model without output, you must use insertValue() and/or updateValue()
$filter->add('myfield','','auto')->insertValue('myvalue');
$filter->add('anotherfield','','auto')->updateValue('anothervalue');
presentation
editing