type: 'cleave' allows extraneous input
See original GitHub issueGiven the following component:
<template>
<div>
<vue-form-generator :schema="schema" :model="model" :options="options"></vue-form-generator>
{{ model }}
</div>
</template>
<script>
import Vue from 'vue'
import VueFormGenerator from 'vue-form-generator'
Vue.use(VueFormGenerator)
export default {
data () {
model: {
dob: ''
},
schema: {
fields: [{
type: 'cleave',
label: 'Date of birth',
model: 'dob',
cleaveOptions: {
date: true,
datePattern: ['d', 'm', 'Y'],
delimiter: '/'
}
}]
}
}
}
</script>
The model will erroneously accept an additional character at the end of input. The model will be updated in Vue, but the change isn’t shown within the actual input element.
For example, the above component will allow me to enter: 030420011
. The value in the model will be 03/04/20011
, BUT the value in the actual field will be 03/04/2001
.
If I backspace, the value in the model is reduced by 2 characters with the value in the actual field being reduced to 1.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Cleave.js Documentation - GitHub
A Boolean value indicates if this is a credit card input field. Enable to trigger credit card shortcut mode. It detects credit card...
Read more >Cleave.js - Format input text content when you are typing
var cleave = new Cleave('.input-element', { creditCard: true, onCreditCardTypeChanged: function (type) { // update UI ... } }); ...
Read more >Hive SQL is giving extraneous input ',' expecting ')' error
extraneous input ',' expecting ')'. I am failing to understand what is causing the error. I tried changing it to the following:
Read more >Glycosylases and AP-cleaving enzymes as a general tool for ...
Rather than depending on hairpins or other extraneous structures, however, the probe incorporates a G residue that mispairs with an A in the...
Read more >Golden Gate Assembly - SnapGene
The method takes advantage of Type IIS restriction enzymes (e.g. BsaI), which cleave DNA outside their recognition sequences.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There is a vue-cleave library that gives some insight - it looks like cleave.js relies on the max length property to guard against extraneous input. I will look into this around 04:30 UTC
I can also confirm that the cleave object itself has the correct data (see
$vm0.cleave.getFormattedValue()
and$vm0.cleave.getRawValue()
both return the value without the extraneous character).I’ll be back if I have any more info to report and hopefully a fix.