laravel-form-builder icon indicating copy to clipboard operation
laravel-form-builder copied to clipboard

Readonly select

Open yurii-zadryhun opened this issue 6 years ago • 2 comments

Hi there. It would be great if supporting of readonly select will be. Because if I will use 'disabled' attribute, then value will not be received on server. In some question on stackoverflow I found this solution:

You should keep the select element disabled but also add another hidden input with the same name and value.

yurii-zadryhun avatar Nov 29 '18 15:11 yurii-zadryhun

You should be able to simulate this on your own, by creating a hidden input and assigning a value from it.

kristijanhusak avatar Dec 07 '18 21:12 kristijanhusak

Here solution to achive readonly. you do not need to use select veriable.

->add('amount', Field::TEXT, [ 'attr' => ['readonly class' => 'form-control-plaintext'], 'rules' => 'required|max:25', 'value' => $this->getModel()->amount ])

var2611 avatar Sep 27 '21 18:09 var2611