conditional-container
conditional-container copied to clipboard
Conditional Container not showing in detail view page
Hi and thanks for the great package. I noticed that if I use a conditional container inside a panel I can't see the fields inside the container in the view page. No problems instead in the edit page, and no problem in the view page if I put the fields outside the container. Someone has the same problem? Thanks.
I'm also curious about this. Conditional fields are not shown on the index or detail views in Nova.
I'm also curious about this. Conditional fields are not shown on the index or detail views in Nova.
That is because you could have multiple records, where each display a different field type for example:
Name | Age | Gender | Something else ....
ID=1 Text | Text | Select | Boolean ID=2 Select | Boolean | Text | Text ....
this would cause the table to be very messy... as each column on each row could represent a completely different thing.. or even worse .. some rows could have more columns than others.. due that conditional container allows you to add any arbritary amount of fields within it...
Conditional Container not showing in detail view page getting same issue
Conditional Container not showing in detail view page getting same issue
You probably forgot to include the HasConditionalContainer that is necessary to render the content correctly on the details page
Conditional Container not showing in detail view page getting same issue
You probably forgot to include the
HasConditionalContainerthat is necessary to render the content correctly on the details page
I had the trait in my Resource Class
With use HasConditionalContainer and I imported the trait
Still getting the same issue
Can you show some sample code of what you are doing? maybe the fields are within a panel (which does not work) ?
Can you show some sample code of what you are doing? maybe the fields are within a panel (which does not work) ?
public function fields(Request $request)
{
return [
RoleSelect::make('Role', 'roles')
->rules('required'),
ConditionalContainer::make([
Heading::make('<h1 class="mb-3 text-2xl font-normal text-90">Transporter Information</h1>')->asHtml(),
Text::make('Licence Number','transporter_licence_nr')
->sortable()
->rules('required', 'max:255')->hideFromIndex(),
])->if('roles = Transporter'),
];
}
I think the issue is that you are using = instead of == or ===...
Or other possible issue I can think of:
- RoleSelect is not returning the correct value Transporter when being accessed.. you can debug this by dd($this) and check that value it holds...
- Maybe the value is being stored as transporter instead of Transporter ?