Hot answers tagged

21 votes
Accepted

What are possible filters in Joomla form fields?

The possible filters are: rules (Access Control Rules) unset (Do nothing, thus leaving the return value as null) raw (No filter) int_array (Filter the input as an array of integers) safehtml (Filter ...
user avatar
  • 26.4k
17 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 ...
user avatar
  • 26.4k
11 votes
Accepted

How to conditionally show fields in module xml?

You can use Joomla's showon attribute in your field. Here's an exmaple: <field name="first" type="list" label="Select Something"> <option value="1">Option 1</option> <...
user avatar
  • 26.4k
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/...
user avatar
  • 8,222
4 votes
Accepted

Trying to save multiple field in Plugin

According to the comments on this question, the answer is to remove filter="string" attribute from XML manifest file.
user avatar
  • 2,275
4 votes

Trying to save multiple field in Plugin

Use value and title (not country) in the sql. I believe your SQL should be as follows: SELECT country_3_code as value, country_name as title FROM #__mymuse_country ORDER by country See SQL form ...
user avatar
  • 7,665
4 votes
Accepted

Range form field type

When ever in doubt about Joomla's form fields, have a look at the following directory, where you will find each one. libraries/joomla/form/fields To get a range form field, you can use the ...
user avatar
  • 26.4k
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 ...
user avatar
3 votes

How to access / modify custom form fields values

how can I access these fields in my loadFormData() function? Actually loadFormData() is used to get the data for the form, but not the form by itself. Why do you need access your custom fields in ...
user avatar
  • 4,045
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.
user avatar
3 votes
Accepted

Saving mobile no in database save filtered no

There's nothing wrong in your code, rather your table definition. Max range of INT in MySQL is: -2147483648 to 2147483647 So instead of using INT for your table field, use BIGINT More details ...
user avatar
  • 2,971
3 votes

How to access a specific fieldset in a form in my model class?

When using the above command to retrieve server request data, the form fields are organized in a key/value array. Which fieldset is irrelevant to retrieving the data from the array, simply use the ...
user avatar
  • 1,396
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 ...
user avatar
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/...
user avatar
  • 46
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 ...
user avatar
  • 8,222
2 votes
Accepted

HTML code disappears in module backend field after save

Try adding filter="raw" to your XML file: <fields name="params"> <fieldset name="basic"> <field name="html_code" type="textarea" rows="10" cols="30" filter="raw" /&...
user avatar
  • 13.3k
2 votes
Accepted

Is it possible to pass data to custom form fields files from a loaded form?

The easiest way is to use the $_POST inside your field class like: $input = JFactory::getApplication()->input; See the reference for JInput. Though it feels like a bad design I do not see any ...
user avatar
  • 4,045
2 votes

Remove form fieldset

I see a lot of weird answers with regular expressions and attribute handling... Why? Joomla! has a great API in JForm to do everything you need. Since it's not quite clear what you want to accomplish ...
user avatar
  • 521
2 votes

Is the new 'showon' attribute only for back-end forms?

It should work as long as your form is generated using JForm. If you build your HTML for the form yourself, then you may have to manually add the needed code and markup. Try rendering the field using &...
user avatar
  • 5,527
2 votes

Is the new 'showon' attribute only for back-end forms?

I guess it's a problem related to system core, Your template/Joomla don't load JS for that functionality, just add JS /media/jui/js/cms.js in your controller where you load form. regards
user avatar
  • 522
2 votes
Accepted

Calling module params from custom field type

You probably forgot to specify container of the form fields. Your code should be something like $this->form->getValue('fallBeginning', 'container') if your field has actual html code like <...
user avatar
  • 471
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 ...
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.
user avatar
  • 503
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 ...
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]...
user avatar
  • 3,134
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'); ?>
user avatar
  • 3,176
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.
user avatar
  • 287
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\...
user avatar
  • 3,072
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 ...
user avatar
  • 2,971

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