aldec
Get form state of 'parent' form inside a relationship
I have a helper function setting a label or visibility of form fields based spatie settings. Which setting is applicable is dependent on a property/form component. Inside my rather complex form I have multiple relationships. The helper functions try access the property of the 'parent' form via $get('myProperty'), but it is not accessible anymore. Can I traverse these form states?
7 replies
Default values not applied in dynamically created form
I have the method below to dynamically build a form based on a JSON structure in a spatie settings row. The idea is create this form, fill it with the predefined default values from the DB and if I change something it changes it in the DB. This worked flawlessly with a flat array of key-value pairs. Now I needed to nest it and make it one layer deeper and it does not work anymore. When I ddd my fields or sections, I can see the default values but in the rendered form in the browser they are not there. This is the method to generate the form:
I am assuming it does not work because of using $typeKey and $safeKey and same matching does not work? I don't know really... I needed to create the $safeKey because Livewire would not render the page itself with using only $typeKey, I think because of some escaping issues.
Code is in the first answer (character limit)
9 replies
Opening modals on page visit
I have several modals in my resource (FilamentComments, a custom 'relation manager' in a modal etc.). Is there a way to have a particular modal opened on visiting the edit page? Or having a table row action which opens the edit page with an opened modal?
5 replies
Accessing relationship data in form lifecycle hook
I'm trying to accessing (and possibly unsetting) a form input in the mutateDataBeforeCreate() hook. The form input is in a relationship (via Group::make()->relationship). But accessing the $data variable only shows the inputs from the root resource, all the relationship-related inputs are not there. How can I access them?
15 replies
File Upload without model/resource
Hi! Is it possible to use the FileUpload component in a custom page to upload arbitrary files? I want to upload a GeoJSON where the contents are parsed and then saved in an addresses table, but the table itself does not need to save the file. Do I need to create some kind of "import model" (similar to the one from the CSV Importer) just to save and hold the file itself?
2 replies