allowNull={false} not working?
See original GitHub issueWhen a user backspaces until an input is blank, the value of the input inside of the values
object becomes null
. Unless I’m misunderstanding, this should never be possible due to the allowNull
prop?
Demo: https://codesandbox.io/s/z6w7qkky83
For scanning
const initialValues = { lastName: '' };
const App = () => (
<Form
debug={console.log}
onSubmit={onSubmit}
initialValues={initialValues}
render={({ handleSubmit, reset, submitting, pristine, values }) => {
if (values.lastName == null) {
console.warn('-------lastName is null----------');
}
return (
<form onSubmit={handleSubmit}>
<div>
<label>First Name</label>
<Field
name="lastName"
component="input"
type="text"
/>
</div>
</form>
);
}}
/>
);
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
notNull: true not working, allowNull: false does #9905 - GitHub
The below INCORRECTLY creates an entry with 'name: null' const Component = db.define( 'component', { name: { type: Sequelize.
Read more >Help with Sequelize allowNull not working. : r/node - Reddit
I have a simple set up in my user model id: { type: DataTypes.INTEGER, allowNull: false, primaryKey: true, autoIncrement: true }, username: ...
Read more >Sequelize - run validations if allowNull === false and the value ...
I've faced this problem: I have a model which has 2 fields (for simplicity, it has more actually), and they are dependant on...
Read more >Validations & Constraints - Sequelize
Without allowNull: false , the call User.create({}) would work. ... has allowNull: false will be defined with a NOT NULL SQL constraint.
Read more >How to use the sequelize-typescript.DataType.BOOLEAN ...
INTEGER, primaryKey: true, allowNull: false, autoIncrement: true}, ... "Secret" * playgrounds are still visible to anyone, but are not indexed into the ...
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
I agree. @erikras I’d suggest unifying it. I can prepare the first draft if you make a decision and give me a direction I should take.
@maciejmyslinski Thanks for the explanation, though! I had no idea why my
form.values
were sometimes disappearing 😅. I’ll proceed using myparse
workaround in the meantime.