How to hide/show a text field depending on the selected value in the select field?
Hello.
I have a category table. The line contains the name and has_close_data fields.
I have a table of courses. On the course creation page you can select a category and closing date. How to hide and show a field depending on the has_close_data category?
Concept:
I have a category table. The line contains the name and has_close_data fields.
I have a table of courses. On the course creation page you can select a category and closing date. How to hide and show a field depending on the has_close_data category?
Concept:
Select::make('category_id')
->relationship('category', 'name')
->preload()
->searchable()
>live()
->afterStateUpdated(function (?string $state) {
// If the selected category_id select field value has_close_data is true, then we do not hide the close_date field; if it is false, then we hide the close_date field.
})
->required(),
DatePicker::make('close_date'),