Form query regarding hidden field

Please help me to get hidden input data when form submitting using livewire…i get null value while sending hidden input

posting some code will help you get some answers

1 Like

How are you setting the value of the hidden field? Are you changing it in javascript? If so, you’ll have to trigger an input event on the field to tell livewire to communicate the changes to your backend.

I send data from livewire component and using foreach loop display with view part and grasping the value and using form hidden field i put the value in value field while submiting form its display null

Uploading: 15919554824402807973501418620674.jpg…
Please see these code from there i send data to view

How to send hidden input field data in livewire? Bez when i sending hidden input using form its show null

1 Like

I am also facing the same issue :frowning:

This can be done using a little javascript

Example you have a select dropdown or an input that when specific event happens send to livewire the updated data.
in backend i want to update the public property call hiddenvalue

<div wire:ignore>
<select id="data">
<option value="a"></optiion>
<option value="b"></optiion>
<input type="hidden" value="data" id="selectdata"/> 

Javascript Part

   document.getElementById('data').addEventListener('change', (event) => {
  const result = document.getElementById("selectdata"); //Get the hidden field value
  if ('a') //Just an example
   @this.set('hiddenvalue',result.value); ///In this part you set property value base on hiddenfield in 
//This just an example on how you can send hidden fields to livewires., you can have other event listener or logic base on your needs.

Any question let me know

1 Like

Slick! man thanks for posting.

1 Like