You can chain the attribute values of showon, using [AND], like so:
Adding more fields to the chain is also allowed.
On a side note, you can use an [OR] clause in the chain too, adding more complexity, for example:
Update for Joomla 3.7:
As of Joomla 3.7, you will be able to to ...
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 safe HTML)
server_utc (Convert a date to UTC based on the server timezone offset)
user_utc (Convert a date to UTC based on the user timezone offset)
url (URL ...
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/controllers/ajax.json.php. It's contents:
defined('_JEXEC') or die;
class ExampleControllerAjax ...
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 field type for other variations that might be more suitable for your need.
When ever in doubt about Joomla's form fields, have a look at the following directory, where you will find each one.
To get a range form field, you can use the following:
label="Choose a number"
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 by the W3C spec. So ensure there are no surplus spaces :)
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 this method?
how can I modify the values of the custom fields before saving? I want to convert them to JSON format to store in a database field.
At the top of ...
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 about integer data types can be found here:
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 form field name given in the XML form definition file. So, if you had a field called 'first_name' you would access like so regardless of which fieldset:
$data = ...
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.
Try adding filter="raw" to your XML file:
<field name="html_code" type="textarea" rows="10" cols="30" filter="raw" />
filter (optional) allow the system to save certain html tags or raw data.
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 other option how to pass the data there.
Also you can access the data of your current form in your field class like this:
$formData = $this->form->getData(...
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 I'll give you three alternatives for doing things the Joomla! Way.
If you want to remove a specific field from a form it's easy to do it if you know the name ...
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 <?php echo $this->form->renderField('title'); ?> or in case of the foreach you could use <?php echo $this->form->renderField($field->...
You probably forgot to specify container of the form fields. Your code should be something like
if your field has actual html code like
<input type="text" name="container[fallBeginning]" value="x">
The container value depends on your xml definition, what is the name of fields. For example
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 mind that the value is then not prepared. If the onContentPrepare event is fired on the article, then the fields are already attached to the item(article).
The answer was given on the forum: https://forum.joomla.org/ by user effrit.
You need to create a layout override for the field. Go to Extensions => Templates => Templates. Select [YOUR-TEMPLATE] - Details and Files. Click on Create override and select Layouts => com_fields => fields. That will copy the com_field render.php into override directory of a ...
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 appropriate Section field based on the value of the Division field. As all this is going to be fairly dynamic you'd want to build up your form dynamically from Division/...
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\views\article\tmpl\default.php to templates\yourtemplate\html\com_content\article\default.php (where 'yourtemplate' is the name of the template you are using).
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 standard HTML textbox field.
You can develop your own custom field if you want pure Joomla form field. See the documentation below.
I haven't looked too much into multiple="true" but an alternative could be using a text box and separating each value with a comma, like so: