is it possible to open a relationship in a modal?
I have a model (property) that is the child in three one to many relationships. I want users to be able to edit the parent record for each of those relationships without having to navigate away from the property. The relationship is currently being set via a select.
Originally I created a hidden subform that was displayed when the select had a value but other than refreshing the entire page I couldn't workout how to populate the data in that subform. Then I tried using a action form via the header actions in the section containing the select and that sort of works but because it is being loaded from what is available in the $record I can't see how to get all of the relation stuff (images, tags, etc.) into the modal.
Originally I created a hidden subform that was displayed when the select had a value but other than refreshing the entire page I couldn't workout how to populate the data in that subform. Then I tried using a action form via the header actions in the section containing the select and that sort of works but because it is being loaded from what is available in the $record I can't see how to get all of the relation stuff (images, tags, etc.) into the modal.
18 Replies
Really, no one has any suggestions, ideas, thoughts, about how this may be accomplished?
The relationship is currently being set via a select.And what's the issue with that? I don't think I fully understand your issue?
I want the user to be able to edit the selected record without having to navigate away from the page.
What kind of page?
If it's an EditPage and you have Selects they don't have to navigate away?
the select lets them choose the related record but the user wants to be able to edit the related record as well
as I said I had a section that contained all of the related record fields via relationship but I don't see anyway to have that section refreshed after the relationship is selected. I then thought about opening the related record in a modal via a action form, but I can see how to use a relationship in an action form
Solution
yes I already tried this but it doesn't accept a relationship
Please share some stuff what you tried and where you encountered issues
so I don't have access to all the stuff on the related model
So you want to edit the relation of the relation?!
I want to be able to edit the related model
Please share some code, screenshots, …
so the main model is property, that is a child in one to many relationships (tenant, owner, building)
I want to find a way to be able to make updates to the parent tenant, owner, building models from the property form
this is the owner section that I tried first
Yes. That's exactly what the
editOptionForm()
/editOptionAction()
is for. So please share what you tried and what issues you hadI don't understand what you mean by "doesn't accept a relationship". This is meant for relationships only
sorry forgot I had changed the relationship on the owner select while I was trying something
ok, I see where I was making it all harder than it had to be now. By dropping the relationship I was having to manually do all the record creation and editing (which I couldn't get to work on editing)
@Dennis Koch Thank you so much for that, I had completely missed the editOption part of the select and was off trying to reinvent the wheel. Went back to basics and all is good.