react-formal: How to set invalid date message, use onsubmit and re-render form
-
How do I set the invalid date message for
type=date
. Right now if I choose a date, and remove it, I get:this (value:
) must be a
datetype
-
If I only want to update my models onSubmit?
<Form schema={modelSchema} defaultValue={modelSchema.default() } onSubmit={ model => this.setState({ model })} >
If I do this:
componentDidUpdate(prevProps, prevState) { console.log(this.state.model) }
I only get a SyntheticEvent Object; This works correctly if I use onChange however. -
How do I force re-render the whole form on schema change? Say if I want to customize the messages.
-
Is there an example how to use errors object?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 16 (16 by maintainers)
That’s not how the schema objects work, there isn’t just a property
dateOfBirth
on the modelSchema. you can either do this:Or if you want to “update” the schema later you need to do something like
Addendum to number 3, if you update the schema prop on the form, it should rerender the entire form, however it won’t re-validate fields in error, that Is probably a good idea tho, I will add it in the next version…