Gravity Forms still the choice?
Html Forms looks really great but not supporting PHP 8 is a blocker for me.
Need both local submissions and Pardot / web hooks. Would love to find something that doesn’t use jQuery.
Gravity Forms still the choice?
Html Forms looks really great but not supporting PHP 8 is a blocker for me.
Need both local submissions and Pardot / web hooks. Would love to find something that doesn’t use jQuery.
Just curious: Did you test with PHP 8.x and encounter issues? Couldn’t find any bug reports for that with HTMLForms…
No – just saw a comment on WordPress.org
I should actually load it!
Care to link to the post / thread in question?
Yeah, you should I like HTML Forms for its simplicity…
We use Gravity Forms primarily. It has good off the shelf options. Like gravity+'s post to third party
We’ve used that to get the submissions out of WordPress or Email and into Google Sheets where more of the team can work the requests we get in an application they are familiar with.
But after working with ACF and ACF Extended more in Sage 10 I’ve been made aware of the Front End Forms option that is available in ACF. And ACF extended offers a UI for managing them.
I want to explore what options might exist with acf-builder and those acf forms.
ACF Pro with Advanced Forms for ACF (Advanced Forms for ACF – WordPress plugin | WordPress.org) for Sage 10 projects.
Link to the post that says the plugin is not PHP 8 compatible:
I’ll test it on a new site, but I think HTML Forms is PHP 8 compatible
Thanks! That issue seems pretty edge-casey though:
“Don’t use it if your WordPress site is on PHP8. Caused a redirect loop on the robots.txt file for me.”
I am using HTML Forms with Sage-HTML-Forms on a new project with PHP 8 and it is saving data and sending emails to Mailhog at this time. I have not tested on a live environment yet.
I’ve always loved this method of building forms the best but I still struggle with some of the options packaged with the plugin for hiding the form after submission or redirecting to a page. Neither of them are currently working as they should.
I can now confirm HTML forms works using MailGun on a staging server. It sends/saves data.
Also, the redirect issue works on staging but not on development. The only thing is that on the staging server, it still doesn’t hide the form and it displays a thank you message below the form before redirecting. Not a huge deal but kind of annoying. It does work though.
For forms that don’t require a user to modify or configure, I’ve been creating REST API endpoints that validate a form submission and then send it off with wp_mail
.
Rough example:
<?php
namespace App\Forms\Api;
add_action('rest_api_init', function () {
register_rest_route(
'forms/v1',
'/contact/',
[
'methods' => 'POST',
'callback' => __NAMESPACE__.'\handle_contact_form',
'permission_callback' => '__return_true',
],
);
});
function handle_contact_form($request)
{
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
return new \WP_Error('invalid_request', 'Invalid request', ['status' => 500]);
}
$name = $request->get_param('name');
$email = $request->get_param('email');
$message = $request->get_param('message');
if (! $name || ! $email || ! $message) {
return new \WP_Error('invalid_request', 'Invalid request', ['status' => 500]);
}
wp_mail(
'hello@example.com',
'Contact Form Submission from '.$name,
"Name: $name\n\nEmail: $email\n\nMessage:\n$message",
['From: '.get_option('name').' <noreply@'.$_SERVER['HTTP_HOST'].'>']
);
return new \WP_REST_Response(['status' => 'ok'], 200);
}
Then I just fetch the endpoint in an event handler for the form submit:
fetch('/wp-json/forms/v1/contact', {
method: 'POST',
body: new FormData(document.getElementById('contactForm'))
})
// Handle response
...
This topic was automatically closed after 42 days. New replies are no longer allowed.