seasonedcc/composable-functions

Unable to retrieve name and value of button after form submission

netdesignr opened this issue · 5 comments

Hi,

I use remix-forms with domain-functions in my project and I would like to find out how to retrieve the form button name and value after form submission. I have to deal with multiple forms on the same page and to avoid the action to run for the whole code i need to track down the button that was pressed.

With plain Remix you can:

 let formData = await request.formData();
 let intent = formData.get("intent");
 
 <button type="submit" name="intent" value="update">

I can't seem to be able to replicate the similar effect using remix-forms and domain-functions

The only data I can see using await inputFromForm is

{
  success: true,
  data: undefined,
  errors: [],
  inputErrors: [],
  environmentErrors: []
}

Can someone please advice?

Thanks a lot!
MIhai

Hey @netdesignr !
What if you log the results of inputFromForm prior to sending it into the domain function?

Hi @gustavoguichard I tried it and I get an object with the field name and values. Unfortunately the button name and value is still no in there...

Ok @netdesignr that is really weird, I'd expect at least { intent: "value" } in that object.

Is there a way you could share the code with us so we investigate further if this is a DF bug?

I've done something similar already and never faced that kind of bug. Let's see if there's anything missing;)

This is a remix-forms bug. I just created the issue above to track it there :)

Thanks for catching it, @netdesignr o/

Thanks a lot @danielweinmann. Unfortunately I would not have been able to share the whole code but I went step by step trough Remix and Domain Functions docs and could not find a way to it.