I was wondering if the following scenario is even possible with sites that are hosted with Webflow:
The first part - Custom form is embedded in the page with method POST, which would post form data to external .php file which is located on a FTP server. Second part - PHP handles data and sends to specified email address.
I have seen solutions for this for exported sites but how to handle custom forms on sites that are hosted by Webflow?
Does anyone has stumbled upon this situation?
@Maris_Pagasts, welcome to the forums and congrats on your first post.
Normally when using an external form processor (self hosted or third-party) the action url would represent a public endpoint accessible by a browser, not FTP. It would be up to you to handle the process on your server on POST. Webflow also supports webhooks on form submission which can be used to send the data to another form server that will accept webhooks.
So what you can do will depend on what you have running on your enpoint.
Thanks @webdev for your answer!
Could you elaborate a little bit more for the concept if I use self-hosted form processor. What are steps to take and technologies to use?
For the reference I want to redo this form with a custom code and add file upload.
Link - https://avotini.webflow.io/lv-general-order
Self hosted form processor (PHP Mailer for example) means installing a local script on a web server and pointing your form processing to that script. There are more complicated tools you could install (formtools.io for example) that have a complete form builder and backend database. When using a local server to send email, there can be delivery issues. Example; server IP address could be blacklisted and mail delivery could be rejected.
That being said, I have used machform.com from appnitro, for years on self hosted servers. It is very robust and has plenty of features. You can purchase a license and install on a server, or go the hosted cloud route.
If you are building your forms in Webflow primarily, you can use a third party processor. These days there are many good, inexpensive, third-party cloud based, solutions you can choose from.
I am currently using Basin (usebasin.com) for some clients where the sites are exported and self-hosted. Fast and easy to implement.
If I use Basin forms as an example with your current form, all I would need to do is create an endpoint in Basin, configure the settings, copy the endpoint URL, then add that as the action for the form, setting the method to Post.
If I wanted the form success and failure message to display like it would using a Webflow form out of the box (blank action and GET method), I could add some custom code to submit the form to Basin via Ajax, and change the endpoint settings for the form to “submit via Ajax”.
This would work regardless of where the site was hosted.
I created a full tutorial / demo on a new blog I am building out, that you can use as a reference. It includes more advanced Spam settings (honeypot and reCAPTCHA) which is bound only to the form, not the whole site. This would not interfere with other native forms if I was hosting on Webflow.
Thank you Jeff !
But there is something I don’t understand: Why a MailChimp integration doesn’t need to use AJAX to display success/failure messages?