Skip to content

Commit

Permalink
fix: fixed field name if label is duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliaghisini committed Oct 19, 2021
1 parent 6657d2b commit 734f7e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/Field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const Field = ({
valid,
disabled = false,
formHasErrors = false,
id,
}) => {
const intl = useIntl();

Expand Down
2 changes: 1 addition & 1 deletion src/components/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { saveAs } from 'file-saver';

export const getFieldName = (label, id) => {
return label?.length > 0
? label?.toLowerCase().replace(/[^a-zA-Z0-9]/g, '_')
? label?.toLowerCase().replace(/[^a-zA-Z0-9]/g, '_') + '_' + id
: id;
};

Expand Down

0 comments on commit 734f7e6

Please sign in to comment.