Rob W
Forum Replies Created
-
Forum: Plugins
In reply to: [Contact Form 7] Form submits with empty required text fieldsAha! Yes, I’ve had that issue before.
Be sure to mark this as resolved!
Forum: Plugins
In reply to: [Contact Form 7] Drop down menu on same line as surrounding textIn your stylesheet, you need to use a proper selector and force the select to display inline.
Example CSS:
.wpcf7-form select { display: inline; }
the problem will be that your validation messages may not display properly.
Forum: Plugins
In reply to: [Contact Form 7] paypal and contact form 7Is it necessary to use CF7 for this?
PayPal can generate forms for you. I suppose we’d need to know more info.
Forum: Plugins
In reply to: [Contact Form 7] date pickerCF7 uses jQueryUI’s datepicker.. this means you can use the “setDefaults()” method to set localization.
Forum: Plugins
In reply to: [Contact Form 7] Am I missing something? How to edit existing fields?You can look in the “Form” text box and edit field tags.
The right-hand side helps generate form tags… they are along the lines of:
[text* name 123/456 id:optional_id class:optional_class placeholder "optional default value"]
Each element above, explained:
text: this is the type of input field.. text, textarea, radio, checkbox, number, email, etc. fields below are for TEXT as each field varies
* (asterisk, optional): asterisk denotes required field
123: size
456: max length
id:optional_id — the html ID attribute of the field
class:optional_class — the html CLASS attribute of the field
placeholder: denotes to use default value as placeholder text (instead of using a label)
“optional default value”: the default value or placeholder text.Forum: Plugins
In reply to: [Contact Form 7] Arrow spinning forever, empty fields in email.Actually, his error is because there is code in his functions.php file (probably an action on
wpcf7_before_send_mail
) which is using old code.Your functions.php file
wpcf7_before_send_mail
action needs to be modified to work with CF7 3.9 or greater. Otherwise, you need to downgrade to CF7 3.8.x.Forum: Plugins
In reply to: [Contact Form 7] External attachment not sent in auto-reply emailYou should upload the PDF somewhere (either on your server, or on your CDN) and simply link to the PDF in your mail(2) message body.
Forum: Plugins
In reply to: [Contact Form 7] Do not submit form with enter key…This can be accomplished via JS:
$('#form_id_here').bind("keyup keypress", function(e) { var code = e.keyCode || e.which; if (code == 13) { e.preventDefault(); return false; } });
Replace the
#form_id_here
with the appropriate form ID, or simply use “form” to disable submit on ALL forms via the enter key.Forum: Plugins
In reply to: [Contact Form 7] Fill field values by clicking on a linked imageA pure JS solution could be done…
First, create a hidden field in the form named “seat” or whatever.
Then, place an image in your page. Use some JS to detect where the user clicked within the image (hint: you can create bounding boxes in x1,y1,x2,y2 in an array). Then, create a click handler that updates the “seat” hidden form field.
Forum: Plugins
In reply to: [Contact Form 7] JS hook for form submissionYes. In your CF7 additional settings, enter:
on_sent_ok: "handleCF7Submit(this);"
(Note: If I recall correctly,
this
will be the form object… but I can’t remember)Then, in your JS file, define the function:
function handleCF7Submit(form) { $("submit button selector", $(form)).val('SUCCESS!'); }
Of course, you’ll need to modify that JS code to make it work, but this should get you going.
Forum: Plugins
In reply to: [Contact Form 7] Form submits with empty required text fieldsI cannot post without all 4 forms filled out.
Forum: Plugins
In reply to: [Contact Form 7] Send to up to 3 recipientsThis is possible using the pipes code… see: https://contactform7.com/selectable-recipient-with-pipes/
If this doesn’t work, you may need to create a new action:
add_action('wpcf7_before_send_mail', 'custom_wpcf7_before_send_mail');
and handle recipients here based on conditions from form post. Example:
add_action('wpcf7_before_send_mail', 'custom_wpcf7_before_send_mail'); function custom_wpcf7_before_send_mail($form) { $wpcf7 = WPCF7_ContactForm::get_current(); $submission = WPCF7_Submission::get_instance(); $data = $submission->get_posted_data(); if(empty($data)) return; // assuming this is a post of an array of CHECKBOXES -- named "recipients" with email addresses of values. NOTE: See NOTE, below code. $recipients = isset($data['recipients']) ? $data['recipients'] : false; $recipientsList = array(); if($recipients) { foreach($recipients as $recipient) { $recipientsList[] = $recipient; } } $mail = $wpcf7->prop('mail'); $mail['recipient'] = implode(",", $recipientsList); $wpcf7->set_properties(array("mail" => $mail)); return $wpcf7; }
NOTE: I highly suggest against using email addresses in values of HTML elements due to web scrapers/spammers. Instead, use something else like ID #’s or names, then reference them back in your code and then setup the recipients.
Forum: Plugins
In reply to: [Contact Form 7] WordPress 4.0 BreakingNeed more info. Any error messages? Are you sure it’s CF7? I haven’t had a problem with it in WP4
Forum: Plugins
In reply to: [Contact Form 7] CF7 does not send messagesTry creating a test.php file and use PHP’s
mail()
function to test your sendmail functionality.. if it doesn’t work, there may be an issue with your server configuration.Forum: Plugins
In reply to: [Contact Form 7] form submit change field valueSince CF7 v3.9, you have to do this differently.
See below for example:
add_action('wpcf7_before_send_mail', 'custom_wpcf7_before_send_mail'); function custom_wpcf7_before_send_mail($form) { $id = $form->id; // gets current form id // CF7 form id => "form label (for you to distinguish)" -- you don't need this, but if you use multiple forms, it may be useful to TARGET x, y, or z forms instead of all forms $formTypes = array( 176 => "Contact Page", //202 => "Questions/Comments Form" ); // check if we want to run this code on selected form if(array_key_exists($id, $formTypes)) { // get current FORM instance $wpcf7 = WPCF7_ContactForm::get_current(); // get current SUBMISSION instance $submission = WPCF7_Submission::get_instance(); // get submission data $data = $submission->get_posted_data(); // nothing's here... do nothing... if(empty($data)) return; // extract posted data $name = isset($data['your-name']) ? $data['your-name'] : ""; $email = isset($data['email']) ? $data['email'] : ""; $phone = isset($data['phone']) ? $data['phone'] : ""; $message = isset($data['message']) ? $data['message'] : ""; // do other stuff here // maybe do some replacements in the cf7 email body? $mail = $wpcf7->prop('mail'); // Find/replace the "special" tag as defined in your CF7 email body $mail['body'] = str_replace("[MyCustomTag]", "Some dynamic text here", $mail['body']); // Save the email body $wpcf7->set_properties(array("mail" => $mail)); // return current cf7 instance return $wpcf7; } }