Field definition should include field size and separate html attributes
See original GitHub issueAurel Drăguţ came with a great idea in order to allow developers to build 2-column layouts, 3-column layouts, etc in their forms.
Just by allowing the developer to place an extra class on the parent form element
<div class='form-group'>
we would be able to easily build panels that look like this:
This would imply a certain syntax change, so the change should come at the same with @cristiantone 's proposition to separate the HTML attributes sent to the input/textarea/select/etc.
Here’s the new proposed syntax for the “text” field type:
$this->crud->addFields([
// mandatory
'name' => 'name',
'type' => 'text',
'label' => 'Name',
// optional
'optionalAttributes' => [
'disabled' => 'disabled',
'style' => 'border: 1px solid red',
...
],
'parentAttributes' => [
'class' => 'col-md-6',
'style' => 'border-top: 1px solid #eee; margin-top: 10px;'
]
]);
@Ghitu , @cristiantone , @mariusconstantin2503 , what do you think?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
HTML attribute: pattern - HTML: HyperText Markup Language
The pattern attribute specifies a regular expression the form control's value should match. If a non-null value doesn't conform to the ...
Read more >HTML Input Attributes - W3Schools
The input size attribute specifies the visible width, in characters, of an input field. The default value for size is 20. Note: The...
Read more >Forms in HTML documents - W3C
An HTML form is a section of a document containing normal content, markup, special elements called controls (checkboxes, radio buttons, menus, etc.), and...
Read more >Dictionary attributes - Product Documentation | ServiceNow
Name Value Target Element
allow_null true/false field_name field
allow_public true/false table_name field
allow_references true/false field_name field
Read more >What are attributes in computing? - TechTarget
The style attribute is used to add different styles to an HTML element, such as color, font or size. Example. <p style="color:purple;"> This...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Done. Works in CRUD 2.1 like this:
But if I want to change custom field width? … write new field type?)