question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

type: 'cleave' allows extraneous input

See original GitHub issue

Given 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.

cleave_bug

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
voughtdqcommented, Feb 27, 2017

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

1reaction
voughtdqcommented, Feb 27, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found