b2bcodext / cms-form-builder

CMS Form Builder is a flexible OroCommerce extension that allows you to easily create forms via UI
Other
8 stars 4 forks source link

Validation failed message not displayed when the form field name has uppercase letters #7

Open jankulma-turbine opened 3 years ago

jankulma-turbine commented 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".

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.

JK

dnahrebecki commented 3 years ago

Hi @jankulma-turbine , confirmed as a bug. Thanks for reporting.