Skip to content

How can I trigger an Action using a form? #556

Answered by gbj
66OJ66 asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah so <ActionForm/> is pretty tightly coupled to server functions, as I think the docs mention but maybe not strongly enough. Maybe it should be named <ServerActionForm/> in reality.

Here are a few options, if you don't want to use a server function

  1. Use a plain <Form/> and copy relevant parts of the <ActionForm/> implementation
  2. Use a plain <Form method="post" action="..."/>
  3. Use a plain HTML element <form method="post" action="..."/> and let the browser handle posting correctly for you
  4. Use node_ref on each of the inputs to get their values, and dispatch your action on form submit
  5. Use signals to hold each of the input values, and dispatch your action on form submit

For 4 and 5 see here.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@66OJ66
Comment options

@gbj
Comment options

@66OJ66
Comment options

Answer selected by 66OJ66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants