Just to add to this (now closed) thread...
http://fabrikar.com/forums/index.php?threads/how-to-add-special-bootstrap-classes-to-elements.35371/
I have attempted in the past to convince the powers that be to change the way both the javascript and css for elements are presented/included in html forms.
The idea of using ?form_#.js? or the template.css php is on the right path ? but does not quite meet the real needs.
Instead of the form id being the determining factor, IMO, it should be the group id.
For example - As is now, if you have a form that contains elements from a repeat group, the ?form_#.js? that is used is taking the ?#? id from the parent form id. So any form_#.js that you may have created ? intended for use with that repeat group - is ignored (not included when rendering the html). ONLY the parent ?form_#.js? is included.
So why not make the ?#? part of ?form_#.js? - or ?details_#.js? - correspond to the group ID ? not the form ID? (And ?include_once? when any repeat group is added.)
This way you could include customized javascript pertinent only to that group ? and, when rendering a form that includes a repeat group, not have to include the javascript for the repeat group as part of the parent ?form_#.js? file (like you must do now).
Also another formatting issue where I?ve requested a change is due to the fact that there is really no unique identifier for the div wrapper that contains an element. This would go a long way in identifying that element within the form (without ?working backwards? from the input element ) when working with css or javascript for that element.
I ?fixed? this by changing one line of code in components/com_fabrik/models/element.php
At line 1940 I changed the code from
...To?
This way there is a unique class name added for each of the elements - added to the element?s ?parent? div wrapper ?making it MUCH easier to identify any of the contents within that element wrapper ? (or to manipulate the element?s div wrapper itself via javascript - show/hide,etc.)
When I first edited the code, I started out adding just the $item->name as the ?unique?class ? but then came to realize that, in some repeat groups I am using, the same element name is also contained in the parent or child group/table ? so I appended the $item->group_id to make it a ?unique? identifier class name.
Wouldn't this concept (using the group id for form_#.js) - coupled with css files working in a like manner - work better than editing or having to create a custom template for each form - as your custom javascript or css files for that group would then ?work? for all form templates, whether the element is in a repeat group or not.
http://fabrikar.com/forums/index.php?threads/how-to-add-special-bootstrap-classes-to-elements.35371/
I have attempted in the past to convince the powers that be to change the way both the javascript and css for elements are presented/included in html forms.
The idea of using ?form_#.js? or the template.css php is on the right path ? but does not quite meet the real needs.
Instead of the form id being the determining factor, IMO, it should be the group id.
For example - As is now, if you have a form that contains elements from a repeat group, the ?form_#.js? that is used is taking the ?#? id from the parent form id. So any form_#.js that you may have created ? intended for use with that repeat group - is ignored (not included when rendering the html). ONLY the parent ?form_#.js? is included.
So why not make the ?#? part of ?form_#.js? - or ?details_#.js? - correspond to the group ID ? not the form ID? (And ?include_once? when any repeat group is added.)
This way you could include customized javascript pertinent only to that group ? and, when rendering a form that includes a repeat group, not have to include the javascript for the repeat group as part of the parent ?form_#.js? file (like you must do now).
Also another formatting issue where I?ve requested a change is due to the fact that there is really no unique identifier for the div wrapper that contains an element. This would go a long way in identifying that element within the form (without ?working backwards? from the input element ) when working with css or javascript for that element.
I ?fixed? this by changing one line of code in components/com_fabrik/models/element.php
At line 1940 I changed the code from
PHP:
protected function containerClass($element)
{
$item = $this->getElement();
$c = array( 'fabrikElementContainer', 'plg-' . $item->plugin);
PHP:
protected function containerClass($element)
{
$item = $this->getElement();
$c = array($item->name.'_'.$item->group_id, 'fabrikElementContainer', 'plg-' . $item->plugin);
When I first edited the code, I started out adding just the $item->name as the ?unique?class ? but then came to realize that, in some repeat groups I am using, the same element name is also contained in the parent or child group/table ? so I appended the $item->group_id to make it a ?unique? identifier class name.
Wouldn't this concept (using the group id for form_#.js) - coupled with css files working in a like manner - work better than editing or having to create a custom template for each form - as your custom javascript or css files for that group would then ?work? for all form templates, whether the element is in a repeat group or not.