Name Validation in vue js

vuejs form validation
vee-validate
custom validation in vue js
vue regex validation
v-validate vuejs
vuetify form validation
vuelidate custom validation
simple-vue-validator

I have a Input filed for name only. How can I validate that with alphabets only. Numbers will not be allowed in that.

<div>
<input type="text" class="from-input" placeholder="Enter Your Name..." v-model="name" />
<span v-if="this.name == ''">Enter a name</span>
<span v-else-if="this.nameValidation">Numbers not allowed</span>
</div>

data(){
  return {
     name: "",
  }
}

computed: {
  nameValidation(){
        if(/^[a-zA-Z]+(?:-[a-zA-Z]+)*$/.test(this.name)){
            return true
        }else{
            false
        }
   }
}

the simpler way is to use native input 'pattern' property. but if you want to use the only Vue for this then you can use this

new Vue({
  el: '#app',
  components: {
  	comp: {
      data() {
      	return{
        	input: '',
          error: ''
        }
      },
      template: `
        <div>
          <input type="text" @keyup="checkValue" v-model="input" />
          <div v-if="error" class="alert">{{ error }}</div>
        </div>
      `,
      methods: {
      	checkValue(){
           if(/[^a-zA-Z]/.test(this.input)) {
           		this.error = 'Input value contains other syantax.';	
           }else{
              this.error = '';
           }
        }
      }
    }
  }
})
input{
    display: block;
    margin-bottom: 5px;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #b3b3b3;
}

.alert{
      padding: 5px 10px;
    border: 1px solid #ff72728a;
    display: inline-block;
    color: #d48888;
    border-radius: 4px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
  <comp></comp>
</div>

How To Validate Forms in Vue.js, Vue JS enables developers to use JavaScript methods to validate form Vue Account</h1> <form> <label for="full name">Full Name:</label>� When validating forms, generally and in Vue.js, we need to define exactly what our needs are which would guide our validation logic. For the purposes of this tutorial, we’ll use a simple form. The form will contain the 3 fields:

Just use the HTML5 pattern property.

<input 
  type="text" 
  class="from-input"
  placeholder="Enter Your Name..."
  v-model="name" 
  pattern="[A-Za-z]+"/>

Using watchers for form input validation in Vue.js, Form validation with Vue.js can be surprisingly tricky. In this article, we see how Vuelidate can be used to make things easier. Vue JS enables developers to use JavaScript methods to validate form inputs within Vue components. In this walkthrough, we’ll use a Vue instance option called watch to implement form input validation. Prerequisites. Vue.js enables developers to create forms in Vue applications just as they would with HTML5.

You can use the costume validation method of Vue to validate Name Filed. Please the read the official Vue documentation in which they explain with example. https://vuejs.org/v2/cookbook/form-validation.html

Simple Vue.js Form Validation with Vuelidate, Any markup relating to validation errors will show on initial load unless using a method like this, or by using validations without v-model (next section). Name. Field� Out of the box validation rules in Vuetify will work for most cases, but every so often you'll need a custom validator. With Vuelidate, each validation rule is a function that returns a Boolean or Promise resolving to a Boolean. This means you can predefine your own validators in a validators.js file and just import each validator when needed.

Vuelidate, to setup form validation in Vue.js with the Vuelidate library. The example is a simple registration form with pretty standard fields for first name,� Let’s look at how to build our own form validation using Vue.js so it behaves the same in all modern browsers. Scenario. We want to build a form with two inputs: Name; Number between 1 and 10; Both inputs are required. The number input should only allow numbers between 1 and 10. Setup. Start with a basic HTML file with the Bootstrap 4

Vue.js + Vuelidate, Then in our form-validation.js file, we will initialize Vuejs and create we need to add name attributes to each field we want to validate, which is� VeeValidate is a form validation library for Vue, that simplifies validation task in Vue projects. So far, the library supports Vue 2 and is quite popular among Vue developers, with more than 2k stars on Github. Vue’s reactivity makes forms interestingly simple to work with.

Form Validation with HTML & Vuejs | by Emmanuel, When it comes to form validation, I'm a huge fan of validating via HTML const app = new Vue({ el:'#app', data:{ errors:[], name:null, age:null,� VeeValidate is a plugin for Vue.js, inspired by PHP Framework Laravel’s validation syntax, that allows to validate input fields and display errors by injecting the validation rules directly into