-
I'm struggling to avoid using I have a multi-select UI where users can select multiple of their portfolios: And then perform various actions on them from the dropdown. Right now the only action is Additionally this component will be used on many screens, with slightly different actions to handle various types of portfolio How do I build this with remix forms?So my first attempt was to name the checkbox on each of the <form>
<button type='submit'>delete selected</button>
<input name='portfolio' value={selected ? portfolioId : null} />
<input name='portfolio' value={selected ? portfolioId : null} />
<input name='portfolio' value={selected ? portfolioId : null} / >
</form> But how do I then describe other submits within the same form, I feel like just opting out of remix forms and using EditI've just found #3138 I like kent's approach there using But also I realise that I cold just describe my updates using the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Add a name to every button in the form and use it to identify the button inside your action. If you have multiple forms with one button, add a single input of type hidden with the same name in every form, and use it to identify the form inside your action. I don't recommend you to use PATCH, GET for loaders and POST for actions is simpler to grasp, and Form doesn't natively work with other methods anyway so in case your form can work without JS it will use POST instead of PATCH and your logic will break. |
Beta Was this translation helpful? Give feedback.
Add a name to every button in the form and use it to identify the button inside your action.
If you have multiple forms with one button, add a single input of type hidden with the same name in every form, and use it to identify the form inside your action.
I don't recommend you to use PATCH, GET for loaders and POST for actions is simpler to grasp, and Form doesn't natively work with other methods anyway so in case your form can work without JS it will use POST instead of PATCH and your logic will break.