Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wuxiaojun514 opened this issue Feb 26, 2024 · 11 comments · Fixed by #1912
Closed
Assignees
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:bug
Milestone

Comments

@wuxiaojun514
Copy link
Contributor

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

@ghost
Copy link

ghost commented Feb 26, 2024

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

@ghost ghost added the Needs: Triage 🔍 label Feb 26, 2024
wuxiaojun514 pushed a commit to wuxiaojun514/sp-dev-fx-controls-react that referenced this issue Feb 27, 2024
wuxiaojun514 pushed a commit to wuxiaojun514/sp-dev-fx-controls-react that referenced this issue Feb 29, 2024
@michaelmaillot michaelmaillot added status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. type:bug and removed Needs: Triage 🔍 labels Apr 25, 2024
@NishkalankBezawada
Copy link
Contributor

Hello,

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

Thanks,
Nishkalank

@wuxiaojun514
Copy link
Contributor Author

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

@RobertSiE
Copy link

RobertSiE commented Jul 28, 2024

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

@wuxiaojun514
Copy link
Contributor Author

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.

@hena-s
Copy link

hena-s commented Sep 6, 2024

Any update on this issue

@gchamplin
Copy link

This is still a problem and it's been several months without any progress.

@gchamplin
Copy link

I see it when I set the ContentTypeId in the Dynamic form. If I leave that prop out I don't see the error message.

joelfmrodrigues pushed a commit that referenced this issue Nov 12, 2024
fix two issues on required field validation issues in Dynamic Form Control
@joelfmrodrigues
Copy link
Collaborator

joelfmrodrigues commented Nov 12, 2024

Hey all, the fix for this has finally been merged, apologies for the long delay.
The fix is now included in the beta release, please let us know if there are any issues.

@joelfmrodrigues joelfmrodrigues added status:fixed-next-drop Issue will be fixed in upcoming release. and removed status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. labels Nov 12, 2024
@joelfmrodrigues joelfmrodrigues added this to the 3.20.0 milestone Nov 12, 2024
@AJIXuMuK AJIXuMuK mentioned this issue Nov 28, 2024
@gchamplin
Copy link

How do I migrate an existing project using v 3.19.0 to use the fixed version (3.20.0).
I tried doing an npm install again with --@3.20.0 but it didn't change in node modules. Do I need to uninstall 3.19.0 first?

@wuxiaojun514
Copy link
Contributor Author

Hi @gchamplin
Based my experience , it would be better uninstall the old version and install new version again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants