No Code Attached Yet
avatar bhuvan-somisetty
bhuvan-somisetty
20 Sep 2026

What happened?

  1. Define a form XML containing a meter field with custom min and max attributes (for example min="10", max="50", value="30"):
<field
    name="my_meter"
    type="meter"
    label="Usage Meter"
    min="10"
    max="50"
    value="30"
/>
  1. Load and render the field using Joomla Form:
$form = new \Joomla\CMS\Form\Form('test');
$form->load('<form><field name="my_meter" type="meter" label="Usage Meter" min="10" max="50" value="30" /></form>');
$field = $form->getField('my_meter');
echo $form->getInput('my_meter');
  1. Inspect the rendered HTML markup or inspect $field->min and $field->max.

Version

5.4

Expected result

  1. MeterField::setup() reads min and max from the XML element attributes ($this->min = 10, $this->max = 50).
  2. $field->min and $field->max return 10 and 50.
  3. The rendered progress bar outputs aria-valuemin="10", aria-valuemax="50", aria-valuenow="30", and width calculated as 50% ((30 - 10) * 100 / (50 - 10)).

Actual result

  1. MeterField::setup() ignores min and max XML attributes, leaving $this->min hardcoded to 0 and $this->max hardcoded to 100.
  2. MeterField::__get() does not handle min and max, returning null when accessing $field->min or $field->max.
  3. The rendered progress bar outputs aria-valuemin="0", aria-valuemax="100", and width 30% ((30 - 0) * 100 / (100 - 0)).

System Information

  • Joomla 5.4-dev / 6.0-dev
  • PHP 8.1 / 8.2 / 8.3 / 8.4 / 8.5
  • Any OS / Web server

Additional Comments

In libraries/src/Form/Field/MeterField.php:

  1. In setup(), attributes width, color, active, and animated are extracted from $this->element, but min and max are omitted:
if ($return) {
    $this->width = isset($this->element['width']) ? (string) $this->element['width'] : '';
    $this->color = isset($this->element['color']) ? (string) $this->element['color'] : '';
    // $this->min and $this->max are never extracted
  1. In __get(), min and max are missing from the switch statement (even though they are present in __set()):
public function __get($name)
{
    switch ($name) {
        case 'active':
        case 'width':
        case 'animated':
        case 'color':
            return $this->$name;
    }

    return parent::__get($name);
}

Adding min and max extraction in setup() and handling them in __get() resolves the issue.

avatar bhuvan-somisetty bhuvan-somisetty - open - 20 Sep 2026
avatar joomla-cms-bot joomla-cms-bot - change - 20 Sep 2026
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Sep 2026
avatar brianteeman
brianteeman - comment - 20 Sep 2026

bug confirmed

as you have a fix please submit a pull request

avatar chmst chmst - change - 12 Oct 2026
Status New ⇒ Closed
Closed_Date 0000-00-00 00:00:00 ⇒ 2026-10-12 14:47:51
Closed_By ⇒ chmst
avatar chmst chmst - close - 12 Oct 2026
avatar chmst
chmst - comment - 12 Oct 2026

Tested and RTC. Thank you!

avatar chmst
chmst - comment - 12 Oct 2026

Tested and PR is RTC. Thank you!

Add a Comment

Login with GitHub to post a comment