Open jankulma-turbine opened 3 years ago
Hi,
When you set a form field to have a name with uppercase letters, eg. "filePDF", the data-name attribute of the input field is generated like so: data-name="field__file-p-d-f".
data-name
data-name="field__file-p-d-f"
When the form is invalid, and an error is returned, its returned using form field name ("filePDF") as index (https://github.com/b2bcodext/cms-form-builder/blob/release/2.0/src/B2bCode/Bundle/CmsFormBundle/Controller/Frontend/AjaxFormController.php#L75), but in https://github.com/b2bcodext/cms-form-builder/blob/release/2.0/src/B2bCode/Bundle/CmsFormBundle/Resources/public/js/app/components/form-component.js#L83 we are looking for the element by data-name (which is "file-p-d-f"), not name, and we end up not finding the element, therefore not showing the error message.
name
JK
Hi @jankulma-turbine , confirmed as a bug. Thanks for reporting.
Hi,
When you set a form field to have a name with uppercase letters, eg. "filePDF", the
data-name
attribute of the input field is generated like so:data-name="field__file-p-d-f"
.When the form is invalid, and an error is returned, its returned using form field name ("filePDF") as index (https://github.com/b2bcodext/cms-form-builder/blob/release/2.0/src/B2bCode/Bundle/CmsFormBundle/Controller/Frontend/AjaxFormController.php#L75), but in https://github.com/b2bcodext/cms-form-builder/blob/release/2.0/src/B2bCode/Bundle/CmsFormBundle/Resources/public/js/app/components/form-component.js#L83 we are looking for the element by
data-name
(which is "file-p-d-f"), notname
, and we end up not finding the element, therefore not showing the error message.JK