Ryuuuu
Explore posts from serversstatePath variable missing some form fields
so i have a few forms on the same page, using multiple forms like this. a couple of those forms have a problem, where only 2-3 of their fields, seemingly at random, will be "detached" from the form, i.e. the console throws a livewire error about "data.property" not found on component, and when inputting in those fields the data object will not update, and when trying to submit the form it will give a "property is required" error as if the field is empty (which it technically is since it never got updated inside the data variable). i've managed to fix this by changing my data definition from
public ?array $data = [];
to public ?array $data = ["property" => ""];
, basically manually initializing only the problematic fields. this way the form works perfectly, including the non-problematic fields that i didn't manually initialize aswell as the problematic fields that are now fixed since i've manually initialized them. the fields themselves don't really have anything special and are delcared the same way as the other, working fields, using functions like TextArea::make() and TextInput::make. anyone have an idea of why just some fields would possibly me skipped from initialization? my workaround fix works right now but it feels kinda hacky and it would be better if i could fix the problem from the root.28 replies
Validate filament form without submitting
Hello guys, im trying to make a big form that has a really custom design, and this form would have multiple steps. But instead of using a single filament form with the step wizard, i went with 5 forms in the same page. This way i could write the step logic myself, using buttons and a step variable to determine which form to show based on the current step, so i could customize the design of the stepper entirely.
The problem now is that i can't seem to get the filament forms to validate separately when going to the next step. Trying to submit them using a form action gives a dd() kind of error message instead of just making the red text appear under each field. I assume this is because i don't have any function for the form to do in the form action. I would need just some sort of formaction that only does the validation and nothing else.
The forms all have their own validation rules, and at the last step i use the data variables in php to gather all of the users answers from the multiple form and do what i need with them. I have a different form variable and data variable in my page for each step, and they are defined properly using getForms() and statePath
18 replies