Passing boolean value to component

Hi,

I have a radio component like this:

<input type="radio" value="true" name="formRequired" wire:model="formRequired">

Whenever server push is sent, it goes out as “true” string, so component does not know how to set a $this->formRequired to a boolean value.

Using wire:click="$set('formRequired', false)" works to set the component value, but in this case wire:model="formRequired" does not work to set the initial state in the browser, as it again cannot read the boolean value, but instead expects strings “false”/“true” for it to work.

Do you have any suggestions how to handle pure boolean values in template, with boolean property in component?

Thanks.

1 Like

Any ideas on this? Creating a getter and setter for a Component and handling it in PHP did not work, as it seems properties on a Component are set in a way which ignores them (which I think should be a bug).

1 Like