Merge pull request #1725 from fthorild/issue1711

This commit is contained in:
Hugo Bernier 2021-02-23 00:06:23 -05:00 committed by GitHub
commit d0963eef33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 5 deletions

View File

@ -47,7 +47,8 @@ The web part allows configuring which list to use and if a form for adding a new
| react-list-form | Harsha Vardhini ([@harshagracy](https://twitter.com/harshagracy)) |
| react-list-form | Ryan Schouten ([@shrpntknight](https://twitter.com/shrpntknight)) |
| react-list-form | Abderahman Moujahid |
| react-list-form | [Kman1131](https://github.com/Kman1131)
| react-list-form | [Kman1131](https://github.com/Kman1131) |
| react-list-form | Fredrik Thorild [@fthorild](https://twitter.com/fthorild) |
## Version history
@ -62,6 +63,7 @@ The web part allows configuring which list to use and if a form for adding a new
| 1.0.6 | October 8, 2020 | Added support for cascading lookup fields |
| 1.0.7 | December 11, 2020 | Fix limit of lookup fields |
| 1.0.8 | February 7, 2021 | Fixed dragging and dropping fields |
| 1.0.9 | February 19, 2021 | Fixed regular expressions for text validation |
## Disclaimer

View File

@ -3,7 +3,7 @@
"solution": {
"name": "react-form-webpart-client-side-solution",
"id": "373a20ef-dfc6-456a-95ec-171de3c94581",
"version": "1.0.8.0",
"version": "1.0.9.0",
"title": "List form",
"supportedLocales": [
"en-US",

View File

@ -1,6 +1,6 @@
{
"name": "react-form-webpart",
"version": "1.0.6",
"version": "1.0.9",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "react-form-webpart",
"version": "1.0.8",
"version": "1.0.9",
"private": true,
"engines": {
"node": ">=0.10.0"

View File

@ -298,7 +298,15 @@ class ListForm extends React.Component<IListFormProps, IListFormState> {
try {
if ((formType === ControlMode.New) || !id) {
const data = this.state.fieldsSchema
.reduce((newData, fld) => { newData[fld.InternalName] = fld.DefaultValue; return newData; }, {});
.reduce((newData, fld) => {
if (fld.DefaultValue && fld.FieldType.indexOf("TaxonomyField") > -1) {
newData[fld.InternalName] = fld.DefaultValue.replace(new RegExp("([#][0-9]+;#|^[0-9]+;#)", "g"), "")
} else {
newData[fld.InternalName] = fld.DefaultValue;
}
return newData;
},
{});
this.setState({ ...this.state, data: data, originalData: { ...data }, fieldErrors: {}, isLoadingData: false });
return;
}