Feature No Code Attached Yet J4 Issue
avatar AndySDH
AndySDH
27 Nov 2019

Steps to reproduce the issue

Create a custom field.

Give a "Field Class".
image

Expected result

This class is supposed to be added to the control-group of the field in the edit form.

Actual result

It's not added anywhere.

System information (as much as possible)

Joomla 3.9.3

avatar AndySDH AndySDH - open - 27 Nov 2019
avatar joomla-cms-bot joomla-cms-bot - change - 27 Nov 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Nov 2019
avatar Quy
Quy - comment - 27 Nov 2019

They are added. See LabelCustomClass and FieldCustomClass.

<div id="attrib-fields-0" class="tab-pane">
<div class="control-group">
			<div class="control-label"><label id="jform_com_fields_text-lbl" for="jform_com_fields_text" class="LabelCustomClass">
	Text</label>
</div>
		<div class="controls"><input type="text" name="jform[com_fields][text]" id="jform_com_fields_text"  value="" class="FieldCustomClass"              />
</div>
</div>
avatar AndySDH
AndySDH - comment - 27 Nov 2019

Oh they're added to the input, not to the main control-group. That's not very useful. It should really be added to the control-group to be able to style the field. Not much you can style when adding it to the input.

avatar Quy
Quy - comment - 27 Nov 2019

Please provide an example that you would you do that you can't do now as it.

avatar mbabker
mbabker - comment - 27 Nov 2019

A wrapping container (.control-group or .form-group with Bootstrap, .field with Semantic UI, etc. etc.) is really more of a framework specific design. To me it's right having the field class apply to the actual form field element (<input>, <select>, <textarea>) and not a wrapping container. And I'd be hesitant to suggest a param for a class on a wrapping container. Then again, the Bootstrap coupling is so real that maybe it isn't that terrible of a thing to force.

avatar ciar4n
ciar4n - comment - 28 Nov 2019

A similar issue here #11887

I agree with @AndySDH on this. True, if you rely completely on CSS frameworks then a class on the field itself has some benefit. For those that write their own CSS, a class on the parent .control-group gives you far greater scope in what can be achieved.

avatar AndySDH
AndySDH - comment - 28 Nov 2019

Please provide an example that you would you do that you can't do now as it.

Well it's very simple. With the current way, you can only style the input.

<input type="text" name="jform[com_fields][text]" id="jform_com_fields_text" class="FieldCustomClass" />

Instead, if the class was in the control-group:

<div class="control-group" class="FieldCustomClass">....</div>

You would be able to style the entire field output, give it a custom background, a custom border, or whatever else. And still also be able to style the input with .FieldCustomClass input

So I see no side effects in having the class in the control-group. It's kinda useless just in the input imho. Didn't even notice it was there and let me to believe it was broken.

avatar ciar4n
ciar4n - comment - 28 Nov 2019

From a user perspective, there is framework classes, they may wish to apply directly to a field which is the point @mbabker is making. It really depends on the type of user we expect with Joomla.

avatar joomdonation
joomdonation - comment - 12 Nov 2022

@AndySDH Is this still needed? Or we can live with what we are having now ?

avatar AndySDH
AndySDH - comment - 12 Nov 2022

I would say this is still needed. It would be a significant improvement and would allow to style individual fields in the form, which is not possible now.

avatar joomdonation
joomdonation - comment - 12 Nov 2022

OK. Thanks for your feedback. Hopefully someone will come up with a solution (I haven't spent enough time with custom fields yet, so I could not comment about it further)

avatar joomdonation joomdonation - change - 12 Nov 2022
Labels Added: No Code Attached Yet J4 Issue
Removed: ?
avatar joomdonation joomdonation - labeled - 12 Nov 2022
avatar fancyFranci
fancyFranci - comment - 19 Jan 2023

Would a third field "wrapper class" could be a solution?

avatar Hackwar Hackwar - change - 19 Feb 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 19 Feb 2023
avatar MacJoom MacJoom - change - 26 Nov 2024
Labels Added: Feature
Removed: bug
avatar MacJoom MacJoom - unlabeled - 26 Nov 2024
avatar MacJoom MacJoom - labeled - 26 Nov 2024

Add a Comment

Login with GitHub to post a comment