Skip to content

Commit

Permalink
fix: replace placeholder of empty fields with nothing in thamkyou mes…
Browse files Browse the repository at this point in the history
…sage
  • Loading branch information
giuliaghisini committed Apr 26, 2024
1 parent e15e1ad commit 8e75c8b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/FormResult.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { useIntl, defineMessages } from 'react-intl';
import { Message, Button } from 'semantic-ui-react';
import { getFieldName } from 'volto-form-block/components/utils';

const messages = defineMessages({
success: {
Expand All @@ -21,6 +22,7 @@ const replaceMessage = (text, sent_data) => {
text = text.replaceAll('${' + idField + '}', sent_data[i].value ?? '');
i++;
}
text = text.replaceAll(/\$\{[^}]*\}/gm, ''); //replace empty fields with nothing
text = text.replaceAll('\n', '<br/>');
return text;
};
Expand Down

0 comments on commit 8e75c8b

Please sign in to comment.