question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Access field errors from parent

See original GitHub issue

Continued from: http://stackoverflow.com/questions/42145302/promote-a-field-error-to-a-form-error?noredirect=1#comment71566856_42145302

Sometimes, errors cannot be DOM children of input fields. A common example is when an error must be displayed above the entire form because there is no space to put the error in the DOM as a peer or child. To achieve this, knowing whether the field has been touched is also required by the parent. While this is achievable in a lengthly mapStateToProps, I propose we offer a helper pattern to make this simpler.

Alternatively, we could create a dummy node & create a portal to it from the child, but then the developer loses functionality of how to show the errors (since it would always be last rendered).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mattkrickcommented, Feb 13, 2017

Yes, that addition sounds reasonable. The anytouched does work because, for example, imagine a credit card form with a number and expiry field. Both have an error because they’re null. After I enter a valid number, then the number is touched with no error but expiry has an error but is not touched. I want the form error to be blank in this case because everything that has been touched has no error.

On Feb 13, 2017 1:16 PM, “Erik Rasmussen” notifications@github.com wrote:

Do you only want to display the error of the touched field(s)? Or would the anyTouched prop http://redux-form.com/6.5.0/docs/api/Props.md/#-anytouched-boolean- help?

If you want to limit it to only touched fields, then it sounds like you are requesting some sort of getTouchedFields(state) selector that returns an array of field names that you could combine with the existing getFormSyncErrors(state) selector http://redux-form.com/6.5.0/docs/api/Selectors.md/.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erikras/redux-form/issues/2585#issuecomment-279524918, or mute the thread https://github.com/notifications/unsubscribe-auth/AFQjvzqmrgDKTG2eVtdbfgrBWshtPpJVks5rcMg7gaJpZM4L_gBI .

1reaction
erikrascommented, Feb 13, 2017

Do you only want to display the error of the touched field(s)? Or would the anyTouched prop help?

If you want to limit it to only touched fields, then it sounds like you are requesting some sort of getTouchedFields(state) selector that returns an array of field names that you could combine with the existing getFormSyncErrors(state) selector.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Method 'Parent' of object failed - ms access - Stack Overflow
1 Answer 1 · Make sure there are no special characters in your forms' names · Compact and repair · Create a new...
Read more >
Parent.error? - Power Platform Community - Microsoft
The default error message that is auto-generated when creating a PowerApp from a Sharepoint form has its Text property set to parent.error.
Read more >
Parent form shows "#Error" in total if subform has no records
Hi everyone, I've got a grand total field on a parent form that adds the value of two summary fields that are located...
Read more >
Microsoft Access: Check if Form Object is a Subform
How do you check if the form object is a subform in Access without triggering a runtime error? Hint: this is a trick...
Read more >
Insufficient Access on Cross Entity Error when creating a child ...
Lookup to OpportunityTeamMember (OpptyTeam: OWD-Controlled by Parent, has field Master to Account). Receiving the error above when creating the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found