vue-form and vue-material are not compatible with each other

In my experience, using a Vue form on a regular HTML <input> element allows validation to work as expected. However, when I switch to using the <md-input> element, the validation no longer functions and an error message is displayed:

Element with v-model not found

Below is a working example with the <input> element:

<vue-form :state="formState" @submit.prevent="onSubmit">

  <validate>
    <label>Name</label>
    <input v-model="model.name" required name="name" />

    <field-messages name="name">
      <div>Success!</div>
      <div slot="required">Name is a required field</div>
    </field-messages>
  </validate>

  <button type="submit">Submit</button>
</vue-form>

However, here is an example where validation does not work with the <md-input> element:

<vue-form :state="formState" @submit.prevent="onSubmit">

  <validate>
    <md-input-container md-inline>
      <label>Name</label>
      <md-input v-model="model.name" required name="name"></md-input>
    </md-input-container>

    <field-messages name="name">
      <div>Success!</div>
      <div slot="required">Name is a required field</div>
    </field-messages>
  </validate>

  <button type="submit">Submit</button>
</vue-form>

Answer №1

Make sure to utilize the md-field and md-input elements for your form.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The integration of cypress-cucumber-preprocessor with multiple testing frameworks appears to be experiencing compatibility issues

I am trying to set up a connection between Cypress and Cucumber, and I came across this plugin: https://www.npmjs.com/package/cypress-cucumber-preprocessor However, I am having trouble with my implementation as it seems to be missing. I have also added th ...

What is the purpose of using an img tag to retrieve a URL that is not an image?

Upon investigating a slow page load, I came across something interesting in the HTML: <img src="/ajax?action=askedAboutCookies" style="display:none" width="0" height="0" alt="" /> When the page loads, it sends a request but never receives a respons ...

Tips for minimizing Angular $digest-cycle invocations

Issue In my application, I have noticed that some callbacks are being called excessively during the $digest cycle. This high frequency of calls is causing performance concerns as these callbacks are triggered way more times than expected, sometimes even e ...

Detecting the clicked link within a React component

My NavBar features a Logo that includes a Link to the Home page "/". The application kicks off from the main page and as per user selections, the UI will adapt accordingly. To offer users a chance to reset everything if they are currently on the Home compo ...

How to use jQuery with multiple selectors?

I am attempting to create a feature where multiple links are highlighted when one is clicked. However, I am encountering an issue where only the link that is clicked is being highlighted, rather than all three links. Below is the code snippet: $('#v ...

Can the environment variables from the .env package be utilized in npm scripts?

I've integrated dotenv into my cypress project and defined variables in a .env file, as shown here: USER=Admin How can I utilize the env variable USER within my npm scripts? "scripts": { "cypress:open": "npx cypress ope ...

How can I retrieve a PDF from a URL provided by the server using AngularJS?

Is it possible to automatically download a PDF file from a URL received through a $http GET() request from the server? The $http request is triggered by clicking a button on the front-end, and upon successful completion of the request, the URL where the PD ...

in JavaScript arrays, the identifier follows the numeric value right away

Can anyone assist me with assigning a PHP array of image filenames to a JavaScript array? I have made some progress, here's my code: <script src="jq.js"></script> <?php $dir = 'images'; $images = scandir($dir); $true_images ...

How can I style the options and optgroups of a select dropdown with CSS, focusing on padding and margins?

In my experience, I have found that padding or margin CSS properties only seem to affect the appearance of options within the select menu in Firefox browser. I attempted the same styling in Internet Explorer and Chrome but it did not have any effect. Is ...

What could be the reason behind the absence of the definition for "console" in an inline function responsible for handling an event from a component?

A component called my-component was created by me, which sends the message my-message using this.$emit('my-message'). To respond to this message, I attempted to utilize <my-component @my-message="()=>console.log('hello')&quo ...

Utilizing jQuery to eliminate spaces and prevent special characters: a comprehensive guide

For my website's signup form, I need to enforce certain rules for the username: The username cannot contain any spaces. The username can only include a dot (.) as special character, similar to how Gmail handles usernames in their signup form. I am ...

JQuery failing to trigger AJAX function

I'm struggling with what seems like a simple issue and it's driving me crazy. The problem lies in this straightforward section of the website. I have a .js file that uses ajax to save a post into the database when the submit button is clicked. A ...

Using AngularJS and ServiceStack webservice, perform the "get('url')" operation

I'm completely new to AngularJS and I'm attempting to retrieve some JSON items from a webservice I quickly set up using ServiceStack. When I enter the URL in the browser, I can see the JSON object without any issues. However, for some reason Angu ...

Guide to extracting a key from a specific index within JSON using Google Apps Script

Is there a way to extract values key11-key44? Just managed to retrieve values key1-key4: const data = JSON.parse(UrlFetchApp.fetch(url, options); const keys = Object.keys(data.paths); for (let a in keys) {return keys[a]} { "id": &q ...

Is it more efficient to use Vue events or Vuex for transmitting data between components?

Working on a project where data needs to be shared between components in order to update a canvas element at 30-60fps for optimal performance on low-end devices. Currently utilizing Vuex store/get method for data transfer, but considering using events as ...

Socket IO: Error - The call stack has exceeded the maximum size limit

Whenever a client connects to my node.js server, it crashes with a 'RangeError: Maximum call stack size exceeded' error. I suspect there's a recursive problem somewhere in my code that I can't seem to find. This is the code on my serve ...

Tips for Creating and Verifying JWE in Node.js

I attempted to use the following code in order to create an RSA-OAEP and A128GCM JWE generator and validator. It successfully encrypts claims and generates the JWE, then decrypts it and provides me with the original claims when running on node.js. However, ...

Is it possible to create a compound editor within a cell in SlickGrid that contains two date fields

Currently, I am implementing SlickGrid with jQuery and I am interested in incorporating a compound editor within a cell similar to example 3a mentioned here. However, instead of two text fields, I would like to have two date fields. Although Example 3 dem ...

Organize Javascript objects based on their dates - group them by day, month,

I've scoured the internet for examples but haven't found a suitable one that accomplishes the simple task I need. Maybe you can assist me with it. Here is an array of objects: [ { "date": "2015-01-01T12:00:00.000Z", "photoUrl": "", ...

Discovering the dimensions of a video in Angular 2 using TypeScript

To determine whether the video is portrait or landscape, I am attempting to retrieve the height and width of the video using the following method: import { Component, OnInit, AfterViewInit } from '@angular/core'; @Component({ selector: ' ...