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

[Form] Dynamically Removed Fields Still Throws Error in Console #2577

Closed
KiddoV opened this issue Nov 30, 2022 · 7 comments
Closed

[Form] Dynamically Removed Fields Still Throws Error in Console #2577

KiddoV opened this issue Nov 30, 2022 · 7 comments
Labels
type/bug Any issue which is a bug or PR which fixes a bug
Milestone

Comments

@KiddoV
Copy link

KiddoV commented Nov 30, 2022

Bug Report

Removing form field dynamically still getting error "Field identifier `field name` not found"!!

Steps to reproduce

https://jsfiddle.net/KiddoV/0wvgbe4q/35/

  1. Open Fiddle!
  2. Hit Remove Field button!
  3. Hit Submit button!

Expected result

Expecting no ERROR in console!!!

Version

2.9.0

@KiddoV KiddoV added state/awaiting-investigation Anything which needs more investigation state/awaiting-triage Any issues or pull requests which haven't yet been triaged type/bug Any issue which is a bug or PR which fixes a bug labels Nov 30, 2022
@lubber-de lubber-de removed the state/awaiting-triage Any issues or pull requests which haven't yet been triaged label Dec 2, 2022
prudho added a commit to prudho/Fomantic-UI that referenced this issue Dec 28, 2022
@prudho prudho added state/has-pr An issue which has a related PR open and removed state/awaiting-investigation Anything which needs more investigation labels Dec 28, 2022
@prudho
Copy link
Contributor

prudho commented Dec 28, 2022

Thanks for your feedback. #2633 should fix this issue.

@lubber-de lubber-de added tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build and removed state/has-pr An issue which has a related PR open labels Dec 28, 2022
@lubber-de lubber-de added this to the 2.9.1 milestone Dec 28, 2022
@lubber-de lubber-de removed the tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build label Jan 17, 2023
@KiddoV
Copy link
Author

KiddoV commented Sep 8, 2023

I am still getting this error on v2.9.3. When removing the field and hit submit.
https://jsfiddle.net/fgw1bqr0/3/

<a class='gotoLine' href='#"Form:", "Field identifier field\-2 not found"'>"Form:", "Field identifier field\-2 not found"</a>
<a class='gotoLine' href='#"Form:", "Field identifier field\-2 not found"'>"Form:", "Field identifier field\-2 not found"</a>

@ko2in
Copy link
Member

ko2in commented Sep 12, 2023

@KiddoV Because, you've removed the field from DOM node, but the form still inspect the node when you submitted the form.

Better use the fields property in form config and remove the relevant field after the element is removed from DOM.

Here's fiddle https://jsfiddle.net/ko2in/kd5pyb9f/6/

@KiddoV
Copy link
Author

KiddoV commented Sep 12, 2023

@ko2in but this approach would conflict the purpose of autoCheckRequired: true. Also imagine that I have a lot of fields and keep repeating myself to define empty validation for each field.

Also @prudho confirmed this is a bug and already had a fixed on #2633, so I would expect some changes here!

@ko2in
Copy link
Member

ko2in commented Sep 12, 2023

Hmm. You're right. It looks strange. I took a quick glance, and this fix already included in the latest build.

Only @prudho version works.

@lubber-de
Copy link
Member

lubber-de commented Sep 12, 2023

The error message still occurs, because the field is still not found while we are internally using a central function to check for fields (which contains the error message)
However, the field is infact removed from validation what prudho implemented, "just" the error message in the console will still bother you.

I fixed this case by #2901

See your adjusted jsfiddle here https://jsfiddle.net/lubber/3725m4o1/1/

@KiddoV
Copy link
Author

KiddoV commented Sep 12, 2023

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Any issue which is a bug or PR which fixes a bug
Projects
None yet
Development

No branches or pull requests

4 participants