Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't retrieve v-select value in post request #979

Closed
Djohn12 opened this issue Nov 3, 2019 · 1 comment
Closed

Can't retrieve v-select value in post request #979

Djohn12 opened this issue Nov 3, 2019 · 1 comment

Comments

@Djohn12
Copy link

Djohn12 commented Nov 3, 2019

Hi,

I'm trying to use v-select in a Laravel/Vuejs project.

When submitting my form with a POST method, the input is not recognized as such since v-select doesn't give it the name attribute I passed it.
Nonetheless, I feel my component is alright since it's data is updated on input change.

Here is my component :

<template>
	<v-select v-model="value" :inputName="name" :id="id" :value="value" :options="tags" multiple/>
</template>

<script>
import vSelect from 'vue-select';
import 'vue-select/dist/vue-select.css';

export default {
  props: {
  	id: String,
        name: String,
  	tags: Array,
  },
  components: {
    vSelect
  },
  data() {
    return {
    	value: null,
    };
  },
};
</script>

In the parent, I give my component some values for its props :

<selector name="techno[]" id="techno" :tags={{ $tags }}></selector>

And here is the generated html :

<div dir="auto" class="v-select vs--searchable" id="techno" name="techno[]">
  <div class="vs__dropdown-toggle">
    <div class="vs__selected-options">
      <input aria-label="Search for option" role="combobox" type="search" autocomplete="off" class="vs__search">
    </div>
    <div class="vs__actions">
      <button type="button" title="Clear selection" class="vs__clear" style="display: none;">
      </button>
      <div class="vs__spinner" style="display: none;">Loading...</div>
    </div>
  </div>
</div>

Expected behavior

  • A generated html5 input with the name attribute passed to v-select as :inputName
  • A generated html5 input with a value attribute reflecting the value of v-model's target

Actual behavior

  • A generated div (with the name attribute) which contains an input type search (without name)
  • No value attribute in any of the generated html code

Desktop (please complete the following information):

  • OS: Ubuntu 18.04.3
  • Browser: Firefox 70.0

I'm not sure this is an issue but I've spent my day looking for solutions without finding any working clue.
Seems to me I'm following the documentation alright...

Please tell me if I missed something in the doc or if this is really an issue.

Best Regards

@Djohn12
Copy link
Author

Djohn12 commented Nov 3, 2019

woops, finally found the related issue

Hope this helps others to find their way to the solution

@Djohn12 Djohn12 closed this as completed Nov 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant