F
Filament4mo ago
nexxai

How to display static, related info on a form? (I don't want to use a form field set to disabled)

I apologize in advance for what is probably an extremely stupid and simple question but I'm only just starting to get deeper into Filament and trying to do more than just super simple CRUD stuff, and I'm hoping someone can point me in the right direction. Let's say I'm editing a record for a model, the record having been created outside Filament. The record might have a piece of related data from a parent relationship (not v4 terminology, just general development) that I do not want to allow edits to, but I do want to be able to display it. For example: if I'm editing the record for a child, I want to show the parent's name on the form, but only for display purposes; the person editing the form should not be able to update the relationship or anything about the parent. I know theoretically I can do a Section::make()->relationship('...'), etc. and then put a disabled TextInput with the contents in it, but that feels so clunky and I feel like I'm missing something super obvious here.
Is there a better way to do this? Do I have to make some kind of custom form input or an entire custom page just to display some data? Thanks for your help!
3 Replies
nexxai
nexxaiOP4mo ago
I've just started looking at the v4 BETA docs and it looks like a text component is what I'm looking for, so I guess my new question is: does something similar exist for v3? Or do I have to wait for v4 to go stable?
nexxai
nexxaiOP4mo ago
Damn this looks like exactly what I'm looking for. Thank you!

Did you find this page helpful?