sp-dev-fx-controls-react icon indicating copy to clipboard operation
sp-dev-fx-controls-react copied to clipboard

[Dynamic Form] Always Show Required Field Validation Error In "FormDisplayMode.Edit" Mode

Open wuxiaojun514 opened this issue 1 year ago • 6 comments

Category

[ ] Enhancement

[x] Bug

[ ] Question

Version

Please specify what version of the library you are using: [ 3.17 ]. It works well in [3.16] Dynamic Form refactored a lot in 3.17

Expected / Desired Behavior / Question

Ideally when you edit an existing item with "Dynamic Form", it should not show "You can't leave this blank." error if this field already has data.

Observed Behavior

When in Edit mode (PageType=6), Dynamic Form control will always show "You can't leave this blank." error on required field even it already has existing data on current item. image

Steps to Reproduce

  1. Choose a list which has a required field (e.g. title) and create a new item. Make sure this new created item has data on required field.
  2. Put "Dynamic Form" in the spfx form customization, no special settings.
     <DynamicForm
          context={this.props.context}
          listId={this.props.context.list.guid.toString()}
          listItemId={this.props.context.itemId}
          onSubmitted={(listItemData: any) => {
            console.log(listItemData);       
              setTimeout(() => {
                this.props.onSave();
              }, 1000);
          }} 
          onListItemLoaded={async (listItemData: any) => { // eslint-disable-line @typescript-eslint/no-explicit-any
            console.log(listItemData);
          }} />
  1. Update EditForm Config in "serve.json" to point to this new created item, then launch it with edit form config image

  2. You will see "You can't leave this blank." error on this item even it already has data on this field image

wuxiaojun514 avatar Feb 26 '24 08:02 wuxiaojun514

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Feb 26 '24 08:02 ghost

Hello,

We are also facing the same error with version 3.18.1. @wuxiaojun514 Any update on the fix?

Thanks, Nishkalank

NishkalankBezawada avatar Jun 07 '24 06:06 NishkalankBezawada

Hi @NishkalankBezawada I created a PR 1781 for it. But it seems waiting some other PR 1726 getting approval first. Right now my fix has not been merged into Dev branch yet

wuxiaojun514 avatar Jun 11 '24 01:06 wuxiaojun514

Hi, @wuxiaojun514 do you have any news regarding to this bug?

RobertSiE avatar Jul 28 '24 21:07 RobertSiE

Hi @RobertSiE. I don't have any update on it. I saw the author of #1726 seems inactive for quite a long time, and several other PRs are also waiting for this pr to be resolved first.

wuxiaojun514 avatar Jul 30 '24 05:07 wuxiaojun514

Any update on this issue

hena-s avatar Sep 06 '24 07:09 hena-s