Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

technofreaks's avatar

Help : Added livewire 3 to existing project, form data binding

Adding livewire 3 to existing project, after installing livewire, created component, copy pasted existing form to livewire view file, updated livewire component.

These are not full page component. Observation, values are passed with class=select, but does not work with select2.

text input field is binding but select input fields such as datepicker, select & multi-select is not binding to livewire.

Need help with binding drop-down select/multi-select, datepicker and checkbox fields and values.

Form

livewire component

dd output

 #__name: "form-datas.create-form"
  #listeners: []
  #attributes: 
Livewire\Features\SupportAttributes\
AttributeCollection
 {#1657 ▶}
  #withValidatorCallback: null
  #rulesFromOutside: []
  #messagesFromOutside: []
  #validationAttributesFromOutside: []
  +code: "0002"
  +date_time: null
  +selLocation: null
  +isActive: true
  +locations: array:3 [▶]
  +categories: array:5 [▶]
  +selCategories: []
}

Thank You

0 likes
2 replies
Mahmoud04's avatar

try to add this js code

<script>
        $(document).on('select2:select', '.select2', function (e) {
            const data = $(this).select2("val");
            @this.set($(this).attr('wire:model'), data);
        });
</script>
technofreaks's avatar

@Mahmoud04 Hi, its not working, these are not full page components. Observation, works with when class=select, but does not work with select2.

Please or to participate in this conversation.