Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add a v-model modifier to treat empty input values as null #3541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bopjesvla opened this issue Aug 27, 2016 · 1 comment
Closed

Add a v-model modifier to treat empty input values as null #3541

bopjesvla opened this issue Aug 27, 2016 · 1 comment

Comments

@bopjesvla
Copy link

bopjesvla commented Aug 27, 2016

The straightforward reason for this request is that there's currently no way to create an optional numeric field using v-model since empty inputs are reset to zero.

The fuzzier reason is that in many if not most models an empty input signifies the absence of its value, hence the error message "Please enter a username" instead of "Please enter a username that isn't empty," and the fact that, in contrast to data validation tools like JSON schema, HTML5 doesn't allow required fields to be empty.

I have no idea what this modifier should be called, though.

@defcc
Copy link
Member

defcc commented Nov 2, 2016

v-model since empty inputs are reset to zero.

According to the description, this should be with 1.0.

@defcc defcc added 1.x and removed 2.0 labels Nov 2, 2016
yyx990803 pushed a commit that referenced this issue Nov 4, 2016
* 	empty string should not be casted to 0. Backport it from vue2

* trim whitespace

* fix coding style

* fix coding style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants