Using
- Drupal 9.1.4
- symfony/property-access I think is on 5.2.0 [that's the last version mentioned in the changelog]
I have a custom built form with some date and number fields, for example:
$form['calculator']['chargeable_consideration'] = [
'#type' => 'number',
'#min' => 0,
'#step' => 0.01,
'#required' => TRUE,
'#size' => 13,
'#attributes' => [
'placeholder' => '£0.00',
],
'#title' => $this->t('description text (£) <button class="tooltip-anchor" title="pop up text">?</button>'),
'#prefix' => '<div class="form-group">',
'#suffix' => '</div>',
];
I have validation checking the dates are within a range, but nothing to check the numbers.
if I use the numbers
- 10000.85
- 123456789.70
- 1234567890
the form works as expected.
If I use the numbers
- 100000.85
- 123456789.71
I get the following error
Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException: Could not parse property path "calculator][chargeable_consideration". Unexpected token "[" at position 11. in Symfony\Component\PropertyAccess\PropertyPath->__construct() (line 111 of vendor\symfony\property-access\PropertyPath.php).
Symfony\Component\PropertyAccess\PropertyAccessor->getPropertyPath('calculator][chargeable_consideration') (Line: 120)
Symfony\Component\PropertyAccess\PropertyAccessor->getValue(Array, 'calculator][chargeable_consideration') (Line: 406)
Drupal\custom_form\Form\CustomForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 82)
How do I prevent it from throwing this exception?