Multiple forms

I have a nice login page that I want to have three forms on: a login form, a password reset form and an unlock account form. Which form is onscreen at any
particular moment is controlled with js by hiding and revealing separate divs containing the forms. But I am not sure how I handle which form is being submitted. In fact, can I have each form submit to a different control? I know i can use form_for to specify which action each form submits to. But how do I have just the form that is on-screen be the one that gets submitted?

Thanks everyone

1 Like

If each div contains it’s own form element (or form_for) then only that form will be interacted with and therefore submitted. The action attribute of each form would determine which route and therefore which controller handled the input.

The key is to have multiple forms complete with fields and buttons, and not a single form with different form fields displayed/hidden.

1 Like