Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

113
Views
Select2 changes the value

I have a select field that displays products and then they can be saved. Because I wanted to have a search option, I also use select2.

I edit all the code in a .twig file and included jquery and select2 as follows:

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script>                        
    $(document).ready(function() {
        $('.js-example-basic-multiple').select2();
    });
</script>

I use Vue to display the products and determine the value.

<select v-model="productEdit.productId" name="productEdit.productId" class="js-example-basic-multiple form-select" style="width: 100%" required>
    <option v-for="product in productsAvailable" :value="product.id">[[ product.groupName]] - [[ product.price.currency() ]]</option>
</select>

I can't use the submit button because I don't pass a value anymore. Before that I didn't use Select2 and the code worked fine.

What is the reason for losing the value and how can I change it?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!