What kind of "action" is required for a webflow form?

Hello,

I’m trying to rebuild a form from scratch within the custom code compenent.
I am not sure what kind of ation I should ask the form to perform so that it submit and works like a regular webflow form ?

Read-only link

Any ideas ?

I’ve tried to rebuild a very simple webflow form within the custom code component, but i’m missing the “action” method apparently. Not sure what to use here ?

The “action” is usually server-side form processor. So for custom forms you would need to redirect to your own processing url. But when you use custom action, default webflow’s success and error messages wont work.

Here’s an AJAX version with webflow default action, which might help your case. How to: Use Ajax to submit forms with default actions after submit

Someone can correct me if im wrong.

1 Like

Hi @Throatscratch,

thank you for the AJAX link, i saw it too while searching for an answer.
I have in the meanwhile come accross a simpler solution sticking with basic html structure:

<!--begening of the custom form-->
<div class="w-form">
  <form id="reservation" name="reservation" date-name="reservation" >
    <input type="text" id="name" name="name" date-name="name" placeholder="Name please" >
    <input type="submit" value="Send" data-wait="Wait..." />
  </form>
</div>

I have been told, the custom code should be wrapped within a div.
The only requirement are the following:

it has to have the div wrapping the form that has w-form class
the form tag must have id, name and date-name that matches each other
the form tag must not have action or method attributes
The input must have name, date-name, and id, that matches each other

And it works ! :slight_smile:

2 Likes

Didn’t know that. Awesome.

Hi Anthony,

Will I be able to run my custom code before submitting the form this way? Will webflow be able to actually collect the form submissions?

Thanks!