cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div id="app">
  <comment-form></comment-form>
</div>
<template id="comment-form"> 
  <div class="form-wrap container">
    <div v-if="!submitted">
      <div class="form-group">
        <label for="email">Email address</label>
        <input 
           v-model="email" 
           v-bind:class="{'form-control':true, 'is-invalid' : !validEmail(email) && emailBlured}"
           v-on:blur="emailBlured = true">
        <div class="invalid-feedback">A valid email is required</div>
      </div>           
      <div class="form-group">
        <a type="submit" href="#" v-on:click.stop.prevent="submit" class="btn btn-lg btn-success">Submit</a>
      </div>    
    </div>
    <div v-else class="alert alert-success" role="alert">
      <h5>Thank you</h5>
      <p>Your validation was a success!</p>
    </div>
  </div><!--end form-wrapper-->
</template>

            
          
!
            
              .form-wrap {
  padding-top:35px;
}
.alert {
  padding-top:1.5rem;
}
.alert h5 {
  margin-bottom:0.0rem;
}
            
          
!
            
              Vue.component('comment-form', {
  template: '#comment-form', 
  data: function () {
        return {
            email : "", 
            emailBlured : false,
            valid : false, 
            submitted : false
        }
    },
  methods : {
    validate : function(){
      this.emailBlured = true;
       if( this.validEmail(this.email)){
          this.valid = true;
       }
    },
    validEmail : function(email) {
        var re = /(.+)@(.+){2,}\.(.+){2,}/;
        return re.test(email.toLowerCase());
    },
    submit : function(){                   
        this.validate();     
        if(this.valid){
          //THIS IS WHERE YOU SUBMIT DATA TO SERVER
          this.submitted = true;
        }
      } //end submit
  }
})

new Vue({
  el: '#app'
})
            
          
!
999px
Loading ..................

Console