afsara_ben
afsara_ben

Reputation: 682

set value of a hidden form field in laravel admin

I want to set a default value for a hidden form field in laravel 8.

$form->hidden("product.product_type")->value('1')->setDisplay(false); 

Here after saving the form, the value is set as null and not 1. What could be the solution?

Upvotes: 0

Views: 2507

Answers (1)

Asad kamran
Asad kamran

Reputation: 450

you have to chain default function

$form->hidden("product.product_type")->value('1')->setDisplay(false)->default('Any Value');

as per documentation here

https://laravel-admin.org/docs/en/model-form-fields#Set%20default%20value

Upvotes: 0

Related Questions