I was just playing around with the Wordpress Form-Action, which I find a very coool feature!
I’ve also read up the tutorial here first: Form | Pinegrow Web Editor
I’m not sure if this is considered as a bug or if i just misconfigured something, but for some reason in my E-Mail Confirmation I don’t see the labels of the Input-Fields.
My Form looks the following (i’m using floating labels of Bootstrap, if that makes any difference):
And the E-Mail I get looks like this:
So all the Labels get replaced with: “contact_form_mailer_id_*”
Any Idea why this is happening, and how I could translate them into nice plain Text, as in the tutorial?
Which label/field/ HTML-Attribute is responsible for that naming here? Is it the HTML-Content of the label itself?
TIA for your help!
Ok, sorry stupid me. The HTML
name attribute is responsible for the naming of the label! Sorry, normally I don’t need that attribute, that’s why I always leave it out!
But maybe a hint in the docs that the
name attribute is responsible for the naming of the label wouldn’t be too bad. Just in Case some people like me stumble around it!
@matjaz Have to come back to that topic since I’m facing another Issue.
The form works fine on my local environment, but whenever I want to use it on a “real” site the form can’t be submitted.
Is there any way to debug whats going on here and why it can’t be submitted?
Thanks in Advance!
@Wolfgang.Hartl which method are you using to process the form: email, post type or callback?
If any of the set options can not be processed (for example, a callback function does not exist) the form fails.
For emails, wp_mail gets called. That fails if PHPMailer has an exception. Are you using default wp_mail or some kind of mailer plugin?
This might help debug mailing issues, or at least determine if that is indeed the issue:
Hey @matjaz , thanks for your response.
Sorry forgot to mention that, I’m just using the mail setting with normal wp_mail(). Standard php_mail…but normally I’m using fluentSMTP which i haven’t set up in that site yet. Will check that link out and see if I can find anything there.
Just one thought i have with the callback (didn’t run any tests on it, maybe it’s totally obvious):
Can I use the callback function without the need of ticking the email/post checkbox? I’ve read somewhere in the docs, that I can pass the form data as argument. I could then simply send 2 emails if I see it right, one for the guy who had filled the form and one to the admin of the site for example? Is the form just using ajax to call that function or is there something special about it to know?!
This might be the reason it fails. Normal wp_mail is very limited.
Yes. The first argument of the function is $form_data, an associative array of key = value data.
The form is not even calling ajax, it is simply form posting to the current page and handling that.
Be careful with sending emails back to the person who submitted the form. That is a way for spammers to send messages to random people (by posting the form with their emails). I would at least do captcha in that case.
Oh, well yes probably. I have to confess that the site is on a hosting I don’t know very good and maybe there is also some problem with the php_mail settings, gonna have a deeper look into that, because normally I was at least able to send a mail with wp_mail()…even if it doesn’t really worked well
Ooooh yes, I see, thanks. - I thought it was ajax because the site loaded so fast that I didn’t even realised a difference
Thanks for that advice. My personal experience with spam mails is that multi-step forms avoid a lot of bot generated spams. So I always aim to include multi-step forms!
But I didn’t think of that way around to use the form as “my personal email provider” and to get my spam sended form a “trusted” Domain is a new idea to me. Those spammers really have great ideas!
But anyway, with the callback function I can create such cool stuff in combination with forms, it’s just simply great in my opinion … have to test that out!