React-final-form: Empty form values are not included on submit

Created on 21 Feb 2019  路  5Comments  路  Source: final-form/react-final-form

Are you submitting a bug report or a feature request?

Maybe it is a feature, but I consider it a bug.

What is the current behavior?

Empty form values and pre-selected options are not included in the submit result.
Related issue https://github.com/final-form/react-final-form/issues/327

<Field name="favoriteColor" component="select">...</Field>
<Field name="description" component="input" />

// result
{
}

What is the expected behavior?

Expected is that every named field has a value in the result.

// this is the result of direct DOM access to form.elements
{
  favoriteColor: "#ABC",
  description: ""
}

Sandbox Link

Upon opening the sandbox, press "SUBMIT" without entering anything.
https://codesandbox.io/s/z66380078l

What's your environment?

Other information

Most helpful comment

This looks related to #130

All 5 comments

This looks related to #130

Any updates here?

Would it make sense to merge the actual final-form values to form.elements so that the empty (default) fields are persisted?

It also prevents validation, the validation function passed to useField is not executed

796 is related. Actually it鈥檚 about the same issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gsantiago picture gsantiago  路  5Comments

kavink picture kavink  路  5Comments

LucienBouletRoblin picture LucienBouletRoblin  路  3Comments

niros-welldone picture niros-welldone  路  3Comments

CodeWithOz picture CodeWithOz  路  4Comments