Indent dependant fields

  • James Riley
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
10 years 1 week ago - 10 years 1 week ago #78778 by James Riley
Indent dependant fields was created by James Riley
Tuan,
I would like to be able to indent my dependant custom fields. For example:



I can do it by putting a whole bunch of nbsp; at the beginning of the field title, but I would like to be able to just do it via CSS. Where in the code can I find the helper/function/etc. that handles fields and decided if they are dependant or not? I would like to tag them with a "dependant_field" class so that I can target them in CSS.

James Riley .: EventBooking user since 2014 ::: JoomDonation user since 2016 :.
.: grfx & web design / IT / AV @ St. Therese Institute of Faith and Mission, Bruno, SK, Canada :.
Last edit: 10 years 1 week ago by James Riley.

Please Log in or Create an account to join the conversation.

More
10 years 1 week ago #78780 by Calum
Replied by Calum on topic Indent dependant fields
or I'm wondering can you not just use the CSS field in the custom fields config.?

Please Log in or Create an account to join the conversation.

  • James Riley
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
10 years 1 week ago #78782 by James Riley
Replied by James Riley on topic Indent dependant fields

calum polwart wrote: or I'm wondering can you not just use the CSS field in the custom fields config.?

I just came to the same conclusion myself! Thanks for confirming what I should have thought of before :whistle:

James Riley .: EventBooking user since 2014 ::: JoomDonation user since 2016 :.
.: grfx & web design / IT / AV @ St. Therese Institute of Faith and Mission, Bruno, SK, Canada :.

Please Log in or Create an account to join the conversation.

  • James Riley
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
10 years 1 week ago - 10 years 1 week ago #78783 by James Riley
Replied by James Riley on topic Indent dependant fields
Well, I tried to add the class via the Custom Field -> Class box, only to discover that the class only applies to the form element (eg. the text box), and not the label text or wrapping div.




So the question of HOW TO APPLY TO THE LABEL still stands -- @Tuan: any suggestions?

James Riley .: EventBooking user since 2014 ::: JoomDonation user since 2016 :.
.: grfx & web design / IT / AV @ St. Therese Institute of Faith and Mission, Bruno, SK, Canada :.
Last edit: 10 years 1 week ago by James Riley.

Please Log in or Create an account to join the conversation.

More
10 years 1 week ago #78791 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Indent dependant fields
I think you will need to edit the code. Try to look at administrator/components/com_eventbooking/libraries\rad\form/field.php, look at getControlGroup method and try to customize it to meet your need

To check that it is a depend field, just use

if ($this->depend_on_field_id > 0)
{
}

Please try to look at it and let me know if you need further assist

Tuan

Please Log in or Create an account to join the conversation.

  • James Riley
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
10 years 1 week ago - 10 years 1 week ago #78794 by James Riley
Replied by James Riley on topic Indent dependant fields
Many thanks, @Tuan! That was exactly what I needed: file, function and variable.

In case anyone else ever digs us this thread, here's what I did.
Just before the getControlGroup's return statement, I added a simple:
Code:
if ($this->depend_on_field_id > 0) $class .= ' dependant_child';

This tags the entire field row. To target the label portion,I used the following CSS:
Code:
.dependant_child label { my-Css-Code }
I decided to tag the entire row in case I ever decide to do something with background color / etc. to further differentiate the dependant fields.

James Riley .: EventBooking user since 2014 ::: JoomDonation user since 2016 :.
.: grfx & web design / IT / AV @ St. Therese Institute of Faith and Mission, Bruno, SK, Canada :.
Last edit: 10 years 1 week ago by James Riley.
The following user(s) said Thank You: Tuan Pham Ngoc

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc