@@ -32,8 +32,7 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi
3232 spfxContext : { pageContext : this . props . context . pageContext }
3333 } ) ;
3434 this . state = {
35- changedValue : props . defaultValue !== undefined || props . defaultValue !== '' || props . defaultValue !== null || ! this . isEmptyArray ( props . defaultValue ) ? props . defaultValue : null ,
36- listItemId : props . listItemId
35+ changedValue : props . defaultValue !== undefined || props . defaultValue !== '' || props . defaultValue !== null || ! this . isEmptyArray ( props . defaultValue ) ? props . defaultValue : null
3736 } ;
3837 }
3938
@@ -643,12 +642,11 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi
643642
644643 private getRequiredErrorText = ( ) : string => {
645644 const {
646- changedValue,
647- listItemId
645+ changedValue
648646 } = this . state ;
649- const { value, newValue, required } = this . props ;
647+ const { value, newValue, required, listItemId } = this . props ;
650648
651- if ( listItemId !== undefined && listItemId !== '' && listItemId !== null ) {
649+ if ( listItemId !== undefined && listItemId !== null ) {
652650 if ( newValue === undefined ) {
653651 return required && ( changedValue === undefined || changedValue === '' || changedValue === null || this . isEmptyArray ( changedValue ) )
654652 && ( value === undefined || value === '' || value === null || this . isEmptyArray ( value ) ) ? strings . DynamicFormRequiredErrorMessage : null ;
@@ -662,8 +660,7 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi
662660
663661 private getNumberErrorText = ( ) : string => {
664662 const {
665- changedValue,
666- listItemId
663+ changedValue
667664 } = this . state ;
668665 const {
669666 cultureName,
@@ -673,14 +670,15 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi
673670 showAsPercentage,
674671 value,
675672 newValue,
676- required
673+ required,
674+ listItemId
677675 } = this . props ;
678676
679677 if ( required && newValue !== undefined && ( changedValue === undefined || changedValue === '' || changedValue === null || this . isEmptyArray ( changedValue ) ) ) {
680678 return strings . DynamicFormRequiredErrorMessage ;
681679 }
682680
683- if ( listItemId !== undefined && listItemId !== '' && listItemId !== null ) {
681+ if ( listItemId !== undefined && listItemId !== null ) {
684682 if ( required && newValue === undefined && ( value === undefined || value === '' || value === null || this . isEmptyArray ( value ) ) && ( changedValue === undefined || changedValue === '' || changedValue === null || this . isEmptyArray ( changedValue ) ) ) {
685683 return strings . DynamicFormRequiredErrorMessage ;
686684 }
0 commit comments