-
Notifications
You must be signed in to change notification settings - Fork 532
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
fixes #340 - "none" value set to null
, formatValueToField checks fo…
#365
fixes #340 - "none" value set to null
, formatValueToField checks fo…
#365
Conversation
…ield checks for `isNil(value)` and returns `null`, none options are always disabled * updated tests to reflect "none is always disabled", could possibly be a selectOptions to allow users to select the "none" option to clear a previously selected value? * added formatValueToField and return `null` when `isNil(value)`
src/fields/core/fieldSelect.vue
Outdated
@@ -1,6 +1,6 @@ | |||
<template lang="pug"> | |||
select.form-control(v-model="value", :disabled="disabled", :name="schema.inputName", :id="getFieldID(schema)", :class="schema.fieldClasses") | |||
option(v-if="!selectOptions.hideNoneSelectedText", :disabled="schema.required", :value="null", :selected="value == undefined") {{ selectOptions.noneSelectedText || "<Nothing selected>" }} | |||
option(v-if="!selectOptions.hideNoneSelectedText", :disabled="true", :value="null") {{ selectOptions.noneSelectedText || "<Nothing selected>" }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the schema.required
was a good solution, because null
can be a good & valid value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverting this change back to schema.required
…into feature/340-select-none * 'master' of https://github.com/icebob/vue-form-generator: fixes vue-generators#362 - `integer` validator now calls `number` validator, and returns `invalidIntegerl: "The value is not an integer"` as well as any errors generated by `number` fixes vue-generators#361 - use $event.target.valueAsNumber for number/range inputs, debounce `formatValueToModel` for number/range, removed `formatValueToField` # Conflicts: # dist/vfg-core.js # dist/vfg.js
Thanks. You can merge it. |
fixes #340 - "none" value set to
null
, formatValueToField checks forisNil(value)
and returnsnull
, none options are always disablednull
whenisNil(value)