conditional-container icon indicating copy to clipboard operation
conditional-container copied to clipboard

Conditional Container not showing in detail view page

Open matteobreschig opened this issue 4 years ago • 8 comments

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.

matteobreschig avatar Jan 06 '21 12:01 matteobreschig

I'm also curious about this. Conditional fields are not shown on the index or detail views in Nova.

ghost avatar Mar 04 '21 22:03 ghost

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...

milewski avatar Mar 05 '21 03:03 milewski

Conditional Container not showing in detail view page getting same issue

mnsuccess avatar Dec 07 '21 19:12 mnsuccess

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

milewski avatar Dec 08 '21 03:12 milewski

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

I had the trait in my Resource Class With use HasConditionalContainer and I imported the trait Still getting the same issue

mnsuccess avatar Dec 08 '21 03:12 mnsuccess

Can you show some sample code of what you are doing? maybe the fields are within a panel (which does not work) ?

milewski avatar Dec 08 '21 03:12 milewski

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'),


];
    }

mnsuccess avatar Dec 08 '21 04:12 mnsuccess

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 ?

milewski avatar Dec 08 '21 04:12 milewski