Skip to content
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

UiTextBox - Allow nulls #253

Closed
iwan-wijaya opened this issue Feb 21, 2017 · 7 comments
Closed

UiTextBox - Allow nulls #253

iwan-wijaya opened this issue Feb 21, 2017 · 7 comments

Comments

@iwan-wijaya
Copy link

iwan-wijaya commented Feb 21, 2017

I think UiTextBox validation is too strict. passing a v-model with the value of null will trigger a validation error.

data () {
    return {
      name: null
    }
 }
<ui-textbox floating-label label="Name" placeholder="Enter your name" v-model="name"></ui-textbox>
[Vue warn]: Invalid prop: type check failed for prop "value". Expected String, Number, got Null. 
(found in component <ui-textbox> at C:\code\packages\keen-ui\src\UiTextbox.vue)

I believe value.required attribute triggers this. https://github.com/JosephusPaye/Keen-UI/blob/master/src/UiTextbox.vue#L105

@JosephusPaye
Copy link
Owner

Hi @iwan-wijaya,

Why not just pass an empty string?

@iwan-wijaya
Copy link
Author

iwan-wijaya commented Feb 26, 2017

Hi @JosephusPaye, That's not always an option when using a backend api.

Many backend apis are returning nulls if a property is empty, some api standards also consider this as good practice.

Imagine fetching data from an api and edit it using a form, if it has nulls in it, it will throw an error, unless you "normalize" the data by converting nulls to empty strings first, which also is not always an option.

@victor-ponamariov
Copy link

+1, got the same issue =(

@JosephusPaye
Copy link
Owner

Support for null will be added in the next version.

@JosephusPaye
Copy link
Owner

Implemented in f5e63d6.

@victor-ponamariov
Copy link

When I updated package.json and downloaded latest version from next branch, I still has the old version it keen-ui/dist folder. How can I update that? Because now it's not possible to use this fix.

Thanks in advance :)

@JosephusPaye
Copy link
Owner

Released in v1.1.0.

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

3 participants