Pending

User tests: Successful: Unsuccessful:

avatar Flowman
Flowman
17 Jul 2025

Pull Request for Issue # .

Summary of Changes

Allow to get the default value of a form field. In some cases if you want to compare the current value to the default value and see if they are different.

Testing Instructions

Grab a random component list view, change its filter_xxx.xml and add a default value to a filter.

In the list view add code:

$this->filterForm = $model->getFilterForm();
$filters = $this->filterForm->getGroup('filter');
foreach ($filters as $fieldName => $field) {
   $field->class .= $field->value != $field->default ? ' active' : ''; 
}

Actual result BEFORE applying this Pull Request

The class active is not added to the field.

Expected result AFTER applying this Pull Request

The class active is added to the file.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar Flowman Flowman - open - 17 Jul 2025
avatar Flowman Flowman - change - 17 Jul 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 17 Jul 2025
Category Libraries
avatar brianteeman
brianteeman - comment - 23 Jul 2025

I added a default value to the com_content status filter and verified that the article manager opened with the list of items filtered by the default value. that field has the class active

image

This is BEFORE applying the PR.

What am I missing as your test instructions say "The class active is not added to the field."

avatar Flowman
Flowman - comment - 23 Jul 2025

@brianteeman the searchtool JavaScript will always add active if the value is not equal to "". Should have written check the field variable for the active class.

avatar brianteeman
brianteeman - comment - 23 Jul 2025

for avoidance of doubt please can you post a screenshot of the expected code result

avatar brianteeman
brianteeman - comment - 23 Jul 2025

and where exactly are you adding this code

$this->filterForm = $model->getFilterForm();
$filters = $this->filterForm->getGroup('filter');
foreach ($filters as $fieldName => $field) {
   $field->class .= $field->value != $field->default ? ' active' : '';
}

Add a Comment

Login with GitHub to post a comment