Open bingstats opened 6 years ago
If the "Percentage of order value" of Insurance Settings is 0, can't save this method with error above, but if you type percentage, it will be saved.
It is related to the input failing client side validation because it is required and 0 is deemed an empty value. The JS error is because the input is in a field set that hides the input from being focussed. See this Stack Overflow issue: https://stackoverflow.com/questions/22148080/an-invalid-form-control-with-name-is-not-focusable
We will need to keep the field set visible or allow 0 as a valid value.
I think it is safe to change the #min value to 0.
$form['options']['insurance_settings']['insurance_percentage'] = [
'#type' => 'number',
'#title' => $this->t('Percentage of order value'),
'#description' => $this->t('Percentage of order to add on as insurance. For example, enter 1.5 to add 150% extra insurance cover.'),
'#min' => 0.1,
'#step' => 0.1,
'#size' => 5,
'#default_value' => $configuration['options']['insurance_percentage'],
'#states' => [
'required' => [
'input[data-states-name="insurance"]' => [
'checked' => TRUE,
],
],
],
];
Thanks a lot! jrhodes
An invalid form control with name='plugin[0][target_plugin_configuration][auspost][options][insurance_settings][insurance_percentage]' is not focusable.