Quantcast
Channel: WordPress.org Forums » [Contact Form 7] Support
Viewing all 49168 articles
Browse latest View live

wpcf7_before_send_mail issues

$
0
0

Replies: 0

I’m using this code;

add_action( 'wpcf7_before_send_mail', 'wpcf7_file_download' );

function wpcf7_file_download($submission)
{
  //check if it is the right form
  if ($submission->id()==11869)
  {
    $submission = WPCF7_Submission::get_instance();
    $submission->add_uploaded_file('pdf', "/wordpress/wp-content/uploads/MandW-Case-Study.pdf");
  }
}

which returns the error
“JSON.parse: unexpected character at line 1 column 1 of the JSON data”

if I take out everything from the function

function wpcf7_file_download($submission)
{
  //check if it is the right form
  if ($submission->id()==11869)
  {

  }
}

I get the same error. What’s going wrong?

BTW I will using a dynamic reference to the file once I have this working so I can’t use your File Attachments option.

I have also, after reading a similar thread, put [pdf] into the File Attachments field, is this correct?

  • This topic was modified 15 minutes ago by chrispink.
  • This topic was modified 2 minutes ago by chrispink.

using wpcf7_before_send_mail to add attachments

$
0
0

Replies: 0

I’m want to attach a pdf to an email after I’ve gather the user’s email address.

The on-page part works fine. But then I need to use the Contact Form 7 hook, wpcf7_before_send_mail to attach the pdf (it’s variable, part of a shortcode.

I have two versions of the hook

1.

add_action( 'wpcf7_before_send_mail', 'wpcf7_file_download' );

function wpcf7_file_download($cf7)
{
  //check if it is the right form
  if ($cf7->id()==11869)
  {
    $uploads = wp_upload_dir();
    $submission = WPCF7_Submission::get_instance();
    $submission->add_uploaded_file('pdf', $uploads['path'].'/MandW-Case-Study.pdf');
    }
}

With the pdf entered as a string. This works but it deletes the file after attaching it.

2.(which is really where I want to head)

add_action( 'wpcf7_before_send_mail', 'wpcf7_file_download' );

function wpcf7_file_download($cf7)
{
  //check if it is the right form
  if ($cf7->id()==11869)
  {
    global $file_path;
    $submission = WPCF7_Submission::get_instance();
    $submission->add_uploaded_file('pdf', $file_path);
   }
}

but this doesn’t work at all. $file_path is within my shortcode thus;

global $file_path;
$file_path = get_attached_file( $postid );
echo $file_path;

And echoes correctly.

So my questions are two; Why does CF7 delete my file after attaching it and how can I stop this? and what am I missing in the second function. There’s no way I can see of interrogating this, echo and console.log simply make CF7 hang.

  • This topic was modified 1 hour, 49 minutes ago by chrispink.

Multi line placeholder in CF7 text area

$
0
0

Replies: 0

Hey

I have an issue that I do hope you can help resolve.

I have created a multi column form using CF7 and Generatepress theme.

Every thing works just fine accept for the following issue.

I have included a multi line placeholder text area as follows:

[textarea textarea-202 placeholder]

* Please provide the details of your project

You can also attach a copy of your project scope

We will contact you if we require additional information

[/textarea]

As per CF7 documentation located here:

https://contactform7.com/text-fields/

Everything works perfectly when viewed in Chrome.

But when viewed in Firefox, the line breaks are stripped out of the placeholder text.

I have found a number of articles on this issue. However I have had no success implementing any one of them:
https://cat-in-136.github.io/2010/06/html5-textarea-placeholder-attribute.html
https://stackoverflow.com/questions/7189223/can-you-have-multiline-html5-placeholder-text-in-a-textarea
https://hashnode.com/post/how-to-insert-line-break-in-placeholder-html5-cirkbxfqn0dvktm5364eoeomh
https://bendechrai.com/2013/04/03/textarea-placeholder-with-new-lines/

Due to the design constraints of the form, it is crucial that I can use a multi line placeholder in the textarea…and that it works accross (all/most) browsers not just Chrome.

Thanks in advance for any help you can provide.

Kind Regards

Upload file not working on mobile devices

$
0
0

Replies: 1

Hi,

I put a contact form (contact form7) at my page and the form works perfectly on desktop.

But when I try to upload via mobile I get an error message. It is not a file size problem, as I tried to upload a very small image and still the error remains.

Thanks!

example of new skip_mail please?

$
0
0

Replies: 0

Hi,

please could you provide an example of hooking the skip_mail into the form with the new functions in 7.4.9?

I am using a 3rdparty service plugin to send the data to Salesforce over cURL, so i need to suppress the email being sent after as it not needed.

thanks
J

Contact form

$
0
0

Replies: 0

Hi,
it seems the contact form I’ve created doesn’t work properly. I have some problems withe the Name, Email, Phone & Direction fields… Also doesn’t work when I try to send an email. Here the code:

<p><label for=”user_name”>Name: <sup>*</sup></label>[text* name id:user_name class:input placeholder “Enter your name here”]</p><p><label for=”user_email”>Email Address: <sup>*</sup></label>[email* name id:user_email class:input placeholder “Enter your email here”]</p><p><label for=”user_phone”>Phone Number: <sup>*</sup></label>[tel* name id:user_phone class:input placeholder “Start typing your number here”]</p><p><label for=”user_project”>Address of My Project: <sup>*</sup></label>[tel* name id:user_phone class:input placeholder “Start typing your address here”]</p><p><label for=”user_pas”>I’m Interested in: <sup>*</sup></label>
[checkbox checkbox-445 use_label_element “Planning Application Service” “Building Regulations Application Service” “Interior Design Service”]
</p>
<br>
<p><label for=”user_comment”>My Project is About:</label>[textarea* textarea-709 id:user_comment placeholder “Enter the description of your project here”]</p>
[submit class:button-primary “Send me the quote now”]

Any help would be great!
Thanks & Regards

Problem with number step validation

$
0
0

Replies: 0

Hello,
I’m using the latest version of the plugin.
I need to do a contact form with a number input with step.
i’ve set also a min a max range.

My problem is that one numeric field also accepts values ​​that should be excluded because they are not part of the step.
For example, if set as step 4 and numbering starts from 0 I should only accept values ​​such as: 4,8,12 instead if I manually enter a number such as 1 or 2 that would be wrong values ​​the email is sent to the same. how can I fix it?

Contact Form 7 + ReCaptcha

$
0
0

Replies: 0

I have problem with my form. Form is working fine with out ReCaptcha.

When I insert ReCaptcha, I can’t press Send button. When I put mouse on the button, the button doesn’t get coloured like without ReCaptcha.

If i click te button I make chech on ReCaptcha.

I using Form in other sites and works perfect.

Please for help.


Drop Downs

$
0
0

Replies: 0

I added a drop down and the first thing it shows is a couple dashes. I’d prefer the word Select, not the dashes.

Here’s what I have now:

<p>How Did You Hear About Us? (required)<br />
[select* HearAboutUs include_blank “Word of Mouth” “Referral” “Facebook” “Twitter” “Google Search”]

Contact Form7 short code for telephone/number not working

$
0
0

Replies: 0

Hi.
For some reason, none of the shortcodes for inputting mobile/telephone number are NOT WORKING.
I have attempted the following shortcodes:
[tel tel-958]
[number number-687]

In looking at several other forms on my site, I see that there is an * after “tel” or “number”…yet when I click the short code generator to insert either of the shortcodes, the asterisk is missing.
I have checked this against other contact forms on my site and the shortcodes with the asterisks work….

I then try to edit the shortcode by adding the asterisk in the “correct” place, save/update form…only to find that I’m not getting it. It only shows
[Mobile Number] on the email I receive…NO NUMBER…for either of these shortcodes.

Here is the page I need assistance with:
https://hiddenlotustarot.com/akashic-records-consultation-read-first/

and here is one of several test emails I have sent to myself in attemtping use/editing of tel/number shortcodes:

tara wordpress@hiddenlotustarot.com via box696.bluehost.com

9:00 AM (11 minutes ago)

to me
From: tara <hiddenlotustarot@gmail.com>
Subject: AR Reading
Mobile Number: [MobileNumber]
Date of Birth & Location: in your dreams tx Jan 1 2001

Message Body:
Completed form

Any assistance would be greatly appreciated.

Emailed Form Information Showing as 1 Giant Paragraph, not as Set up

$
0
0

Replies: 0

Hello+

I think my first post about this issue was lost in the mail since you never responded and I submitted it a month ago… So, I am submitting a new one here, again. I hope that you get it and let me know how to fix the problem as my client is now getting upset about it.

I have created a multi-question form using this plugin and when the system emails my client the information submitted in the form it all comes in as 1 large paragraph (not as I set up the email to display, under “Mail”).

I tested this and found that the email that is sent out as an auto-reply does show up as I set up to display, under “Mail (2)”. This is confusing as I copied/pasted the submitted information and format from the “Mail” part over to the “Mail (2)” part. So, I do not understand why the top part is not mailed as I laid out, but the bottom part is mailed as I laid out.

If you need to view the emails or log-in information, then please tell me where/how to submit that to you privately on this forum as I do not see how to give you that privately. I have provided a link to the page with the form on it (above).

Please let me know how to fix this.
Thank you, +Es

Contact Form 7 and MailPoet 3 do not work together anymore!

$
0
0

Replies: 0

Hi!

Until today I was happily using the plugin ‘MailPoet – Contact Form 7 Integration’.
Using the shortcode [mailpoetsignup] I was able to add a checkbox to my form for optionally subscribing to a specified MailPoet newsletter list.
Unfortunately this plugin was not updated since 2 years!

Additionally today I updated WordPress to version 4.8.1 and upgraded MailPoet to version 3.
Now checking the newsletter checkbox in the form does not do anything anymore.

Can you, please, give me some advice with which other newsletter plugin I can realize what I had all the time again keeping Contact Form 7?

Thank you very much in advance!

Kind regards,
Gerald

Validation errors occurred

$
0
0

Replies: 0

form is requiring fields that are not marked required.

CF7 doesn’t work any more

$
0
0

Replies: 0

Hi!
There’s something wrong with my CF7 since June. Can’t receive the submit message through CF7 setting email.
However, I can check the messages by “contact form DB” plugin.

I tried to switch other themes, update the theme, deactivate all other plugins, change the form email, consult with the host provider( blue host).

It’s really important to me. I need help. Thank you in advance.

Nora

How to add Validation to Custom Form Tag cf7

$
0
0

Replies: 0

Im just created a custom form tag using CF7 but the problem is it cant validate

here is my code

add_action( ‘wpcf7_init’, ‘custom_add_form_tag_timepicker’ );
function custom_add_form_tag_timepicker() {
wpcf7_add_form_tag( array(‘timepicker’,’timepicker*’), ‘wpcf7_timepicker_shortcode_handler’, TRUE );
}
function wpcf7_timepicker_shortcode_handler( $tag ) {

$tag = new WPCF7_FormTag( $tag );

if ( empty( $tag->name ) ) {
return ”;
}

$class = wpcf7_form_controls_class( $tag->type );

$atts = array();
$atts[‘class’] = $tag->get_class_option( $class );
$atts[‘id’] = $tag->get_id_option();

$atts[‘name’] = $tag->name;
$atts = wpcf7_format_atts( $atts );

$html = ‘<div class=”form-group”>’;
$html .= ‘<div class=”input-group bootstrap-timepicker”>’;
$html .= ‘<input %s type=”text” class=”form-control” placeholder=”00:00″/>’;
$html .= ‘<span class=”input-group-addon”>’;
$html .= ‘<span class=”glyphicon glyphicon-time”></span>’;
$html .= ‘</span>’;
$html .= ‘</div>’;
$html .= ‘</div>’;

$html = sprintf( $html , $atts );

return $html;
}


Required fields?

$
0
0

Replies: 0

Form is requiring fields that are not marked required (the radio buttons).

Google Analytics Tracking with Redirect

$
0
0

Replies: 0

Need some urgent help with my code here:

script type=”text/javascript”>
document.addEventListener( ‘wpcf7mailsent’, function( event ) {
if ( ‘183’ == event.detail.contactFormId ) {
ga( ‘send’, ‘event’, ‘Form’, ‘Submit’, ‘Enquiry Form’ );
location = ‘http://website.com/thank-you/’;
}
else if ( ‘184’ == event.detail.contactFormId ) {
ga( ‘send’, ‘event’, ‘Brochure’, ‘Download’, ‘Brochure Downloaded’ );
location = ‘http://website.com/thank-you/’;
}
}, false );
</script>

As you can see with my setup, I implemented tracking on my forms that triggers some event in analytics then redirect to a thank you page. It was working properly on our previous landing pages but now it doesn’t seem to work. Any help will be appreciated

Contact form 7 Error with SSL or wp-api or both.

$
0
0

Replies: 0

Hello!

First of all I want to thank you for a wonderful plugin that I have used for many years on many sites. But now I have encountered a problem that I cannot solve:

My site is using http / ssl and some time ago the contact form stopped working.

When I look into the console I see this message:

Mixed Content: The page at 'https://www.page-name.se/salja/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.page-name.se/wp-json/contact-form-7/v1/contact-forms/79/feedback/'. This request has been blocked; the content must be served over HTTPS.

So my question is first of all if contact form 7 does work with SSL sites. The other question would be if it can be a problem with the wp api instead.

How would I solve this?

Thanks in advance.

/Daniel

How can I give a label for a checkbox

$
0
0

Replies: 0

How can I give a label for a checkbox:

Example:

[checkbox checkbox-329 “service”]

I would like in the autoresponder: – got the text: “we are glad you are interested in the service”

On mobile, telepohone field is more long than the others fields

$
0
0

Replies: 0

Hello,

When I view my site on a mobile de devices, the “telephone” field is more longer than the others fields.

Please could you let me know how could I fix it?

Many thanks.

Viewing all 49168 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>