aerni / statamic-livewire-forms

Supercharge your Statamic forms with Livewire
https://statamic.com/addons/aerni/livewire-forms
Other
28 stars 2 forks source link

Hide text field with `input_type: hidden` #26

Closed aerni closed 1 year ago

aerni commented 1 year ago

This PR replaces PR #23. If a text field has input_type: hidden, it will be removed from the frontend. This is the same behavior as when using the Hidden fieldtype.

I first thought that it might be a good idea to NOT remove hidden fields from the frontend but simply hide them with CSS. This would allow manipulating a field's value with JS. However, I completely forgot that this approach doesn't work due to Livewire's security measures. If you want to manipulate a field's value, you have to do it within the Livewire component. And the field doesn't have to be present on the frontend to change its value.