DateInput or ArrayInput with warnWhenUnsavedChanges are triggering an alert when submitting the form
See original GitHub issueHello!
What you were expecting:
I’m using the warnWhenUnsavedChanges
option on my TabbedForm
, it was working as expected until I add a DateInput
in my form.
When I update my date in the form, I don’t want to have the “unsaved” alert when I’m submitting my changes.
What happened instead:
- When I change the date in my form, I have the “unsaved” alert when I submit the form.
- When I change other fields (and not the date), I don’t have the issue.
- When I confirm the alert, the submit is working, my date is correctly saved.
- It seems to be the same issue with
DateTimeInput
.
Steps to reproduce:
Using the option warnWhenUnsavedChanges
in a TabbedForm
, with a DateInput
inside it.
Related code: I don’t have much code to show, the components are a bit split:
export const UnitCreate: FC = (props: any) => (
<Create {...props} undoable={0}>
<TabbedForm warnWhenUnsavedChanges>
<MainFormTab />
<TermsFormTab />
</TabbedForm>
</Create>
);
export const MainFormTab: FC<MainFormTabProps> = (props: any) => {
return (
<GenericMainFormTab {...props} hideDefaultField>
<TextInput
disabled={props.disabled}
fullWidth
label="resources.unit.title"
source="title"
validate={[required()]}
/>
<DateInput
disabled={props.disabled}
label="resources.unit.rightsEndDate"
source="rightsEndDate"
/>
</GenericMainFormTab>
);
};
Environment
- React-admin version: 3.8.4
- React version: 16.13.1
- Browser: Chrome 85
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (5 by maintainers)
Top Results From Across the Web
DateInput or ArrayInput with warnWhenUnsavedChanges are ...
DateInput or ArrayInput with warnWhenUnsavedChanges are triggering an alert when submitting the form.
Read more >trigger an browser alert when submitting a form - Stack Overflow
im trying to let the user know that he submitted his form by a simple alert, but somehow this leads to not working....
Read more >React-admin - The Create and Edit Views
Warning about unsaved changes is an opt-in feature: you must set the warnWhenUnsavedChanges prop in the form component to enable it: export const...
Read more >Trigger a button click and generate alert on form submission in ...
Trigger a button click and generate alert on form submission in JavaScript - Let's say the following is our button − Submit O...
Read more >react-admin: Versions | Openbase
Fix <ArrayInput> throws an error when providing a helperText (#8276) (slax57) ... Fix null values cause warning in forms (#8212) (fzaninotto) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
See #5776 which should be released in next patch version
I have the same issue after updating the react-admin version from 3.8.2 to 3.11.2. It works for some FormWithRedirect forms and doesn’t work for TabbedForms at all. Any news??