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

tab label not change to red while one of it's input with source='post.title'(the source like x.y) is invalid #3695

Closed
atares0223 opened this issue Sep 16, 2019 · 11 comments · Fixed by #3711
Labels

Comments

@atares0223
Copy link

atares0223 commented Sep 16, 2019

What you were expecting:
tab label change to red while one of it's input with source='post.title' is invalid.
What happened instead:
tab label not change to red, once click save, you don't know where is invalid for a TabbedForm.
Steps to reproduce:
create a TabbedForm with FormTabs.
create some tabs.
have one input with source='post.title' and required.
switch to other tab , the tab have 'post.title' is not showing warning red label.
<TextInput source="post.title" validate={required()}/>
image
image

Related code:
https://codesandbox.io/s/simple-ttj4i?fontsize=14

Environment:

React-admin version: 2.9.1 and v3 alpha
React version: 16.8.6
Browser: Chrome

@atares0223 atares0223 changed the title Tabbedform not showing validation warning on second tabForm. Tabbedform not showing validation warning for tab label on second tabForm. Sep 16, 2019
@djhi
Copy link
Collaborator

djhi commented Sep 16, 2019

Please follow the issue template

@atares0223 atares0223 changed the title Tabbedform not showing validation warning for tab label on second tabForm. Tabbedform not showing validation warning for tab label while the source of Input is belongs to a object e.g. source='post.title' Sep 16, 2019
@atares0223 atares0223 changed the title Tabbedform not showing validation warning for tab label while the source of Input is belongs to a object e.g. source='post.title' tab label not change to red while one of it's input is invalid Sep 18, 2019
@atares0223 atares0223 changed the title tab label not change to red while one of it's input is invalid tab label not change to red while one of it's input with source='post.title'(the source like x.y) is invalid Sep 18, 2019
@atares0223
Copy link
Author

atares0223 commented Sep 18, 2019

@djhi please help me figure it out. it not support complex source for a input.

@djhi
Copy link
Collaborator

djhi commented Sep 18, 2019

Your codesandbox does not use the version of react-admin you specified in the issue template: it is based on the v3 alpha and not on v2.9.1.

Besides, using v2.9.6, I cannot reproduce the issue.

Please either provide a codesandbox with the version of react-admin you are actually using or correct your issue description

@atares0223
Copy link
Author

atares0223 commented Sep 18, 2019

@djhi thanks for help , my dev version is v2.9.1 and the codesandbox is v3 alpha. it's both not working.
I think I don't make myself clearly, the codesandbox can reproduce the issue.
steps in the codesandbox:

  1. go to post edit page.
  2. make sure that the 'post.title'(the input is under SUMMARY tab) is empty so that it will trigger a invalid required warnning event under the 'post.title' input.
  3. switch to other tabs except SUMMARY.
    4.it should trigger a event that make the label of the SUMMARY tab to red 'SUMMARY' , but it's not. since the source is changed from 'title'->'post.title' (a format like x.y)

@djhi
Copy link
Collaborator

djhi commented Sep 18, 2019

Try upgrading to 2.9.6

@djhi
Copy link
Collaborator

djhi commented Sep 18, 2019

I cannot reproduce your issue on the official codesandbox (https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple)

@atares0223
Copy link
Author

atares0223 commented Sep 18, 2019

@djhi sorry ,but I can reproduce the issue through
https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple
steps:

  1. go to one of Post Edit View and makes the title to empty.you can see the 'title' is required warning.
    image
    2.switch to BODY tab. so you can see the SUMMARY tab is red.
    image
  2. change source the title input from source='title' to source='post.title' .
    image
  3. do the step 1 again, you can see the 'Post.title' is required warning.
    image
    5.do the step 2 again (switch to BODY tab), and now the SUMMARY tab is not red!!
    image

@djhi djhi added bug and removed needs more info labels Sep 18, 2019
@djhi
Copy link
Collaborator

djhi commented Sep 18, 2019

Sorry, I read your description too quickly apparently. Confirmed

@atares0223
Copy link
Author

cool , @djhi ,thanks.

heesienooi added a commit to heesienooi/react-admin that referenced this issue Oct 4, 2019
* next:
  Fix TabbedForm does not detect errors when source is a path Fixes marmelab#3695
  Update CoreAdminRouter.tsx
  Fix failing test in Node 12
  Add hooks to Reference list
  Add missing (double)quote in i18nProvider upgrade guide
  Add missing quote in i18nProvider upgrade guide
  Fix example for dispatch hook in upgrade guide
  useQuery/useQueryWithStore - fix loading state
  Welcome message should be visible on narrow screens
@atares0223
Copy link
Author

Hi @djhi , I had reinstalled react-admin at version of ^2.9.7. but this bug is still existed, what version can I use or waiting for 3.00 version release?

@fzaninotto
Copy link
Member

The introduction of FormGroups in 3.12 (#5712) finally solves this properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants