Skip to main content
19 votes
Accepted

Form field "showon" with multiple fields

You can chain the attribute values of showon, using [AND], like so: showon="field1:1[AND]field2:1" Adding more fields to the chain is also allowed. On a side note, you can use an [OR] clause in the ...
Lodder's user avatar
  • 26.9k
5 votes
Accepted

How to execute an ajax script to update form fields in an .xml file rendered by Akeeba FOF?

You can use JSON format in the controller directly by adding .json suffix and changing format in your URL to json. In this case the controller would be placed in /administrator/components/com_example/...
Sharky's user avatar
  • 11.3k
4 votes
Accepted

Form field "checkboxes" mutliple default values

Set a comma separated property "checked" in the XML file rather than using default and you should be good. We also do not call trim on the comma separated values as having spaces in values is allowed ...
George Wilson's user avatar
3 votes

How to execute an ajax script to update form fields in an .xml file rendered by Akeeba FOF?

This component is developed using Akeeba FOF, so you need to read the documentation to know how to complete the task. Almost everything is configured using XML, this is to some extent of course. To ...
Mohamed Abdelaziz's user avatar
3 votes
Accepted

Creating a field plug-in, need the com_content form to be enctype multipart

There really isn't a good way to do this. Your best bet is parsing the already generated HTML and making a replacement there. For the component this can be done using onAfterDispatch event. Below is a ...
Sharky's user avatar
  • 11.3k
3 votes
Accepted

Repeatable field not visible anymore?

Are you talking about the repeatable custom field? If so, then you could try the following: Download a copy of the latest Joomla (3.9.26 as of this writing). Go to the folder /plugins/fields. Copy/...
René's user avatar
  • 46
3 votes

Calendar Field Type

I would guess there's an implicit timezone conversion happening. It's saving the time as midnight GMT in the DB, but on re-display, it's converting it to local time.
George Sexton's user avatar
2 votes
Accepted

DPFields display values in module

Glad you like it. If you just need the value, then use the field model as you can see here https://github.com/Digital-Peak/DPFields/blob/master/com_dpfields/admin/helpers/dpfields.php#L137. Keep in ...
Laoneo's user avatar
  • 503
2 votes

Joomla 3.7.x PHP API set value of custom user field

Don't mess directly with the table! Use the field model which has a setValue function. It allows you to write the value correctly into the database as done in the system plugin.
Laoneo's user avatar
  • 503
2 votes
Accepted

Override output for repeatable custom fields

Here is the solution I came up with for my question: $programs = $fields['programs']->rawvalue; $class = $fields['programs']->params->get('render_class'); $items = json_decode($programs, ...
Mike Hermary's user avatar
2 votes
Accepted

Fields component media field using absolute url instead of relative

I think you are looking for the rawvalue property of the field object /* Rearrange Fields for use */ foreach($this->item->jcfields as $jcfield){ $this->item->jcFields[$jcfield->name]...
jamesgarrett's user avatar
  • 3,299
2 votes

Joomla Field autopopulate on select of another field

You can use the "showon" field attribute to hide/show a field depending upon the value of another field. So you could have lots of Sections fields - one for each Division - and show only the ...
Robbie Jackson's user avatar
2 votes
Accepted

How to update colorpicker fields to Joomla 4.x

Neither form fields, nor their layouts are really designed to be used outside of Form API. Things can break very easily this way. A form instance is expected in some fields and a field instance in ...
Sharky's user avatar
  • 11.3k
2 votes
Accepted

Get the form fields as defined in the form xml file

There is Joomla\CMS\Form\Form::getFieldset() method for returning an array of fields belonging to a fieldset as Joomla\CMS\Form\FormField objects. $fieldNames = []; foreach ($form->getFieldset('...
Sharky's user avatar
  • 11.3k
1 vote

Show article fields in module

Assuming this is for Joomla 3, you can use the following: use Joomla\CMS\Factory; use Joomla\CMS\MVC\Model\BaseDatabaseModel; \JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/...
Lodder's user avatar
  • 26.9k
1 vote
Accepted

Should language file definitions/translations be used by multiple forms with the same text?

I started out following the Joomla examples and did have form or view name in all labels but found it easier to just have one definition per extension. For circumstances where you might need an ...
Irata's user avatar
  • 3,927
1 vote
Accepted

Custom field type with showon attribute for list options

This is what I finally did. If someone knows a cleaner solution please let me know. defined('JPATH_BASE') or die; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Form\FormHelper; ...
Mike's user avatar
  • 351
1 vote

Custom fields published state not working as expected

It's unknown what exactly is your $fields variable, what values it contains (how it has been produced), where you use this code and generally your question lacks context. However, note that when a ...
FFrewin's user avatar
  • 19.7k
1 vote
Accepted

How to make field attribute label work

Assuming you're using Joomla's default search tools layout, it does not render labels. You can create a custom layout or a layout override specific to your component. To accomplish the second option: ...
Sharky's user avatar
  • 11.3k
1 vote

Why doesn't this 'usergrouplist' field show a label?

The problem is likely in your view. What do you get when you print something like the following in your view? <?php echo $this->form->getLabel('view_access'); ?>
itoctopus's user avatar
  • 3,226
1 vote
Accepted

Why doesn't this 'usergrouplist' field show a label?

It worked after I uninstalled and reinstalled the component. So apparently there's nothing wrong with the code.
Glitch's user avatar
  • 287
1 vote
Accepted

How to identify which JForm list field triggered the submission of my form?

Create a hidden field in your form: <field name="example" type="hidden" /> Before submitting the form, populate this field with the ID or name of the field used to submit the form: &...
Sharky's user avatar
  • 11.3k
1 vote

Form validation in Joomla with form rules doesn't work

The filename must be lowercase and match the name of the rule (not including casing). So rename Custom.php to customnumber.php. Setting the message through $element->attributes()->message doesn'...
Sharky's user avatar
  • 11.3k
1 vote

How to add placeholder to input field via php variable

You need to follow below steps Go to components/com_yourcomponent/models/forms Find out the xml file which loads that form. Find the fields where you want to add the place holder text. Use hint ...
crazyKida's user avatar
1 vote

How to add placeholder to input field via php variable

I believe that hint is the attribute you're looking for: <field name="name" label="Name" type="text" required="true" hint="Placeholder Text" default="" />
Ben Harold's user avatar
1 vote

Joomla custom fields management

You can do that with the built-in custom field types. Go to Content > Fields Create a field with the name "Speakers" of type "Checkboxes". Create the values (at the bottom of ...
Sakis's user avatar
  • 161
1 vote
Accepted

How could I make Joomla! fields as a function

I presume you're in a template override of com_content. In which case your $this will point to an instance of a view class, eg. ContentViewArticle or something. PHP does allow you to declare ...
jamesgarrett's user avatar
  • 3,299
1 vote

Joomla media extra field without Alt tag

First, you'll need to create a separate field for the alt tag. Make a note of this and the image field's ID. You then need to override the article layout. To do this, copy components\com_content\...
RichardB's user avatar
  • 3,082
1 vote

Joomla field type as star rating

There is no standard form field type for star rating. However, you can decorate a standard form field look like star rating. For example, the below jQuery library can generate star rating using ...
Nagarjun's user avatar
  • 2,991

Only top scored, non community-wiki answers of a minimum length are eligible