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.

allowNull={false} not working?

See original GitHub issue

When 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:open
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
maciejmyslinskicommented, Oct 10, 2018

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.

2reactions
sarinkcommented, Oct 10, 2018

@maciejmyslinski Thanks for the explanation, though! I had no idea why my form.values were sometimes disappearing 😅. I’ll proceed using my parse workaround in the meantime.

Read more comments on GitHub >

github_iconTop 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 >

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