collapse form section on submit

I have a use-case that would probably be more like a wizard, but I have limited screen real estate and I need to use a slideover. So my thought was to use a form section and once that section is submitted, to collapse it and open up the next form section. I tried using a prop on the component and then setting it when the form is submitted, passing that prop into the ->collapsed() method, which I see takes a closure. Unfortunately, the prop is getting updated, but it seems the form section is only rendered once (maybe?). I did eventually kind of get it working but you'd have to click the submit button two or three times to make it collapse, which isn't ideal. Is there any way to accomplish this? Can I tap into the collapsed attribute of the section with alpine or something?
2 Replies
awcodes
awcodes2mo ago
Although not easy, the easiest solution would probably be a custom accordion component. But seems weird to me that the whole form is needed to be submitted to move onto the next section. Would also be easier if it wasn’t separate sections. Which is why I recommend an accordion. Will be easier to get the active ‘section’ if it’s part of the same component. I think #lara-zeus-accordion might already be able to do this. But not sure.
Jon Mason
Jon Mason2mo ago
Good points. yeah, I may have to rethink it. It's technically 2 forms with 1 section each, but I dunno, it's just not working the way I'd like so I need to figure out something else.
Want results from more Discord servers?
Add your server
More Posts