Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

115
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda