Hot answers tagged

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 ...
  • 26.7k
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> <...
  • 26.7k
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/...
  • 9,621
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 ...
  • 26.7k
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 ...
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 ...
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.
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 ...
  • 2,981
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/...
  • 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 ...
  • 9,621
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 ...
  • 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 &...
  • 5,537
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
  • 522
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" /&...
  • 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 ...
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 <...
  • 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 ...
  • 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.
  • 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 ...
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]...
  • 3,209
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 ...
  • 9,621
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: ...
  • 9,621
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'); ?>
  • 3,186
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.
  • 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: &...
  • 9,621
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 ...
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="" />
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 ...
  • 3,209
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\...
  • 3,072

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