-
-
Notifications
You must be signed in to change notification settings - Fork 327
AutoForm.getFieldValue() returns undefined after removing any elements from #afEachArrayItem #833
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
Comments
Perhaps unrelated, but my issue seemed similar. I'm getting AutoForm.getFieldValue() to return undefined after performing an update function. The form field still contains a value that I was using elsewhere with a getFieldValue(), but after submitting/updating the form, it returns undefined. This getFieldValue in 5.1 is haunting me... 😭 If I put AutoForm.getFieldValue("fieldName"); in the developer console, it returns: |
@aldeed. Any hint on my issue? Am I doing something wrong there or is this a bug? Appreciate any hint that helps me to resolve the issue. Thanks |
I am facing the exact same issue. Have been stuck for long thinking I am doing something wrong. |
The problem is that in This gets into the complexity of the array tracker, so I'll have to figure out a proper solution. |
Its like this for me:
The added element should = |
Just to add what I found, I am doing a custom field for an array and I wanted to have sort of an "afFieldValueIsIn" helper. I found everytime you add an item to the array via AutoForm the index is like this: 1,2,3. Then, if you delete the second item via AutoForm remove item button, index are like this. 1, 3. getFieldValue of the now "second item" is getFieldValue('example.3.example') but doesn't exist. I found that you still be able to know the value of the second item but for this you need to getFieldValue('example.2.example'). |
This bug makes it difficult to use array fields in AutoForm for anything beyond basic use cases. If you want to provide any kind of custom options for a type="select" field that depend on other field values in the same array item, you're out of luck, since you can't rely on introspecting data from the current array item via AutoForm.getFieldValue(). |
@aldeed Hi Eric, any update regarding this? any suggested solution? |
@fashkl yesterday we released the new major 7.0 release. Would you mind giving it a try and see if this issue got resolved? These functions are also mentioned in the CHANGELOG (although this was implemented by @pouya-eghbali). |
After I delete an element from a form (using #afEachArrayItem), the
AutoForm.getFieldValue()
is not working anymore. It seems that this.current index does not match the one getFieldValue() uses.I set up repository showing the problem: https://github.com/miri-am/autoform-destroy-test
Am I doing something wrong or is this not supported by Autoform?
The text was updated successfully, but these errors were encountered: