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][3.17] Required Field Validation won't work #1760

Closed
wuxiaojun514 opened this issue Feb 8, 2024 · 2 comments · Fixed by #1912
Closed

[Dynamic Form][3.17] Required Field Validation won't work #1760

wuxiaojun514 opened this issue Feb 8, 2024 · 2 comments · Fixed by #1912
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 ]

Expected / Desired Behavior / Question

Dynamic Form should stop submission if there is any empty required field.
However this functionality won't work as expected after I upgraded to 3.17

Observed Behavior

[Dynamic Form] changed a lot in new version. I noticed that it will still submit item even the required field is empty

Steps to Reproduce

  1. Choose a list which has a required field (e.g. title)
    image
  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. Launch it, and leave this required field empty and save it.
    image

  2. You will see you created a new item which keep this required field empty
    image

Trouble Shooting

This is due to the latest "Dynamic Form" changed a lot of things. The initial value of "field.newValue" is "undefined" not "null"
image
I will do more testing on it.

@ghost
Copy link

ghost commented Feb 8, 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 8, 2024
wuxiaojun514 pushed a commit to wuxiaojun514/sp-dev-fx-controls-react that referenced this issue Feb 26, 2024
@michaelmaillot michaelmaillot added status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. and removed help wanted Good First Issue 🏆 labels Apr 25, 2024
joelfmrodrigues pushed a commit that referenced this issue Nov 12, 2024
fix two issues on required field validation issues in Dynamic Form Control
@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
@joelfmrodrigues
Copy link
Collaborator

@wuxiaojun514 , 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.

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.

3 participants