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.

Problems with value attribute set on input

See original GitHub issue

Versions:

  • VueJs: v2.1.8
  • Vee-Validate: 2.0.0-beta.18

Description:

I have a text input field that I’d like to set the “value” attribute on without using a Vue data model. Essentially am wanting PHP to do the HTML rendering of the input and Vue/Vee to do the JS validation. If no value attribute is set, it works fine. If a value attribute is set, then it will not allow any editing of the field (well, it simply changes back to the originally inputted value quickly… you can test with debounce to see that happen)

Steps To Reproduce:

Here is code to reproduce the issue (just note the value=“My Value” attribute):

HTML:

<div id="form">
	<label class="label" for="email">Email</label>
	<p :class="{ 'control': true }">
		<input value="My Value" v-validate data-vv-rules="required|email" data-vv-name="email" :class="{'input': true, 'is-danger': errors.has('email') }" name="email" type="text" placeholder="Email">
		<span v-show="errors.has('email')" class="help is-danger">{{ errors.first('email') }}</span>
	</p>
</div>

Javascript:

<script type="text/javascript">
Vue.use(VeeValidate, { delay: 500});
new Vue({
	'el': '#form'
})
</script>

I feel like I’m missing something here easy and haven’t been able to find it yet. Thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
chiragparekhcommented, Mar 21, 2017

Have same issue with Vue 2.2.0. It happens when I use v-bind:value=“”

https://jsfiddle.net/g0xjq2nk/10/

1reaction
daylightstudiocommented, Jan 13, 2017

Thanks for checking in on this and providing an update @logaretm… much appreciated and great work on this plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Input element's value attribute is not set · Issue #18725 - GitHub
Current behavior. When initializing a FormControl with an initial value, the html input element's value attribute is not set. Expected behavior.
Read more >
HTML Input is not updating value attribute on change
The value attribute contains the default value for an input, not the live value. The DOM value property contains a live value.
Read more >
<input>: The Input (Form Input) element - HTML
The autocomplete attribute takes as its value a space-separated string that describes what, if any, type of autocomplete functionality the input ...
Read more >
HTML5 Forms: Value Attribute - Wufoo
The value attribute is used to set the value of <input> elements: it defines the value associated with the input and the value...
Read more >
Set the value of an input field in JavaScript - GeeksforGeeks
text: It specifies the value of the input text field. · attributeValue: This parameter is required. It specifies the value of the attribute...
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