[enh] Improve UX in validation

This commit is contained in:
ljf 2021-09-13 02:36:16 +02:00
parent b9b0dd906f
commit abfd018a46
6 changed files with 9 additions and 8 deletions

View file

@ -46,12 +46,12 @@ export default {
computed: { computed: {
disabled () { disabled () {
return this.validation ? this.validation.$invalid : false return false // this.validation ? this.validation.$invalid : false
}, },
errorFeedback () { errorFeedback () {
if (this.serverError) return this.serverError if (this.serverError) return this.serverError
else if (this.validation && this.validation.$invalid) { else if (this.validation && this.validation.$anyError) {
return this.$t('invalid_form') return this.$i18n.t('form_errors.invalid_form')
} else return '' } else return ''
} }
}, },

View file

@ -2,7 +2,8 @@
<b-alert :variant="type" show> <b-alert :variant="type" show>
<icon :iname="icon_" /> <icon :iname="icon_" />
<vue-showdown :markdown="label" flavor="github" <vue-showdown :markdown="label" flavor="github"
tag="span" class="markdown" /> tag="span" class="markdown"
/>
</b-alert> </b-alert>
</template> </template>

View file

@ -100,7 +100,7 @@ export function formatYunoHostArgument (arg) {
if (!isNaN(parseInt(arg.max))) { if (!isNaN(parseInt(arg.max))) {
validation.maxValue = validators.maxValue(parseInt(arg.max)) validation.maxValue = validators.maxValue(parseInt(arg.max))
} }
validation.numValue = validators.numeric validation.numValue = validators.helpers.regex('Please provide an integer', new RegExp('^-?[0-9]+$'))
} }
}, },
{ {

View file

@ -183,7 +183,8 @@
"passwordMatch": "Passwords don't match.", "passwordMatch": "Passwords don't match.",
"required": "Field is required.", "required": "Field is required.",
"remote": "{message}", "remote": "{message}",
"pattern": "{type}" "pattern": "{type}",
"invalid_form": "The form contains some errors."
}, },
"form_input_example": "Example: {example}", "form_input_example": "Example: {example}",
"from_to": "from {0} to {1}", "from_to": "from {0} to {1}",

View file

@ -26,7 +26,6 @@
<icon iname="download" /> {{ $t('users_export') }} <icon iname="download" /> {{ $t('users_export') }}
</b-dropdown-item> </b-dropdown-item>
</b-dropdown> </b-dropdown>
</template> </template>
<b-list-group> <b-list-group>