mark_weston
Forum Replies Created
-
Anybody able to help?
You can use <table cellpadding=”1″ cellspacing=”1″> or css.
One suggestion to remove all the grey space at the top right of the form is to have 2 tables: 1 for the top fields and 1 for the bottom fields. Have a look at the skeleton code below:
[Code moderated as per the Forum Rules. Please use the pastebin]
Another source of help is to view the source code for the example site you gave at the start of this thread.
Have fun!
Yes. This is copied direct from the CF7 editor for one of my forms.
<table> <tr> <td>Your Name (required)</td> <td>[text* your-name 50/100]</td> </tr> <tr> <td>Your Email (required)</td> <td>[email* your-email 50/100]</td> </tr> <tr> <td>Your Phone Number</td> <td>[text your-phone 50/100]</td> </tr> <tr> <td>Best Time to Call</td> <td>[text best-time-to-call 50/100]</td> </tr> <tr> <td valign="top">Your Message</td> <td>[textarea your-message 60x10]</td> </tr> <tr> <td></td> <td>[submit " Send "]<//td> </tr> </table>
You can set up your table as you like.
David,
One suggestion, use tables like this:
+-----------+----------+ | heading | field 1 | +-----------+----------+ | heading | field 2 | +-----------+----------+ | heading | field 3 | +-----------+----------+ | heading | field 4 | +-----------+----------+ +-----------+-----------+-----------+-----------+-----------+ + heading | heading | heading | heading | heading | +-----------+-----------+-----------+-----------+-----------+ + field 5 | field 6 | field 7 | field 8 | field 9 | +-----------+-----------+-----------+-----------+-----------+ + field 10 | field 11 | field 12 | field 13 | field 14 | +-----------+-----------+-----------+-----------+-----------+ + field n | field n | field n | field n | field n | +-----------+-----------+-----------+-----------+-----------+ + field n | field n | field n | field n | field n | +-----------+-----------+-----------+-----------+-----------+
Regards,
MarkYes – tried 2 emails comma separated, no joy.
Great workaround thanks !!!
Forum: Plugins
In reply to: [Plugin: Contact Form 7] Execute PHP at "on_sent_ok" timeInstead of using the Additional Settings you could try the wpcf7_before_send_mail functions
Check out https://www.ads-software.com/support/topic/plugin-contact-form-7-cf7-posted_data-checkbox-fields
Hi,
I’m pleased to say that YES it is possible to have data submitted from a Contact Form 7 form stored into a database. You have also use Contact Form 7 to create posts with the submitted information!
There is a plugin to store the data in a database: https://www.ads-software.com/extend/plugins/contact-form-7-to-database-extension/
It is also reasonably easy to write the code to do this. Check out some of my other posts or search for ‘wpcf7_before_send_mail’.
Regards,
MarkForum: Plugins
In reply to: [WP eCommerce] [Plugin: WP e-Commerce] No Products / can’t edit productsHas there been a fix to this yet? It’s a bit of a pain to turn off drag n drop to edit and then turn it back on again.
Suggestion for the future – store the form entries in a database or post. Theres a CF7 database plugin https://www.ads-software.com/extend/plugins/contact-form-7-to-database-extension/ or check out this post
Rishel,
If you want to just create an email from the form and you then manually copy/pasto that information into a new post then all you need to add to your form is:
[select* company-news-category “AR10” “PARTS” “BACKPACKS” “KNIVES” “MOUNTS” “NEWS” “OPTICS” “RIFLE ACCESSORIES” “SHEATHS” “SOFTWARE” “VESTS”]
What I am doing is using a CF7 form to create a page automatically – saves on all that copy paste. I’m not that much of a developer/programmer either – I just used what I could find on the internet.
The form uses a checkbox to identify the category. You could just as easily use a drop down list box.
I then use the code in functions.php (one of your theme files) to then create the page (or it could be a post).
In your case it could be something like this:
Contact Form
‘<p><b>Your Name</b> (Required)[text* your-name 75/] </p>
<p><b>Your Company Name</b> (Required)
[text* your-company-name 75/] </p>
<p><b>Your Phone Number</b> (Required)
[text* your-phone-number 75/] </p>
<p><b>Your Email</b> (Required)
[email* your-email 75/] </p>
<p><b>Company News Title</b> (Required)
[text* company-news-title 75/] </p>
<p><b>Company News Content</b> (Required)
[textarea* company-news-content 76×20] </p>
<p><b>Company News Category</b> (Required)
[checkbox* company-news-category “AR10” “PARTS” “BACKPACKS” “KNIVES” “MOUNTS” “NEWS” “OPTICS” “RIFLE ACCESSORIES” “SHEATHS” “SOFTWARE” “VESTS”]
<p>[submit “Send”]</p>’
functions.php
‘remove_all_filters (‘wpcf7_before_send_mail’);
add_action( ‘wpcf7_before_send_mail’, ‘contactform7_before_send_mail’ );function contactform7_before_send_mail( $cf7 ) {
// Submit Company News
if ( 1 == $cf7->id ) { // this is the id of the contact form$your_name = $cf7->posted_data[“your-name”];
$your_company_name = $cf7->posted_data[“your-company-name”];
$your_phone_number = $cf7->posted_data[“your-phone-number”];
$your_email = $cf7->posted_data[“your-email”];
$company_news_title = $cf7->posted_data[“company-news-title”];
$company_news_content = $cf7->posted_data[“company-news_content”];
$company_news_category = $cf7->posted_data[“company-news-category”];$categories = array();
$categories[] = 17; // this is the id of the company news category
foreach ($company_news_category as $the_category) {
$categories[] = get_cat_ID($the_category);
}$my_post = array();
$my_post[‘post_title’] = $company_news_title;
$my_post[‘post_content’] = $company_news_content;
$my_post[‘post_status’] = ‘draft’;
$my_post[‘comment_status’] = ‘open’;
$my_post[‘ping_status’] = ‘closed’;
$my_post[‘post_author’] = 1;
$my_post[‘post_category’] = $categories;
$new_post_id = wp_insert_post( $my_post );update_post_meta($new_post_id, ‘Your_Name’, $your_name);
update_post_meta($new_post_id, ‘Your_Phone_Number’, $your_phone_number);
update_post_meta($new_post_id, ‘Your_Email’, $your_email);}
}’
The only tricky part is making sure the category descriptions match up.Mark
Hi,
I’ve done something similar. Check out this posting: https://www.ads-software.com/support/topic/plugin-contact-form-7-cf7-posted_data-checkbox-fields
What I’m still working on is how to dynamically populate the checkbox field.
Regards,
MarkForum: Plugins
In reply to: [Plugin: Contact Form 7] checkbox field valuesAnyone who can help? Do I need to look at creating a custom module?
Thanks for your help. Here’s the code I finally used:
// Submit an Article if ( 6 == $cf7->id ) { $contact_name = $cf7->posted_data["contact-name"]; $contact_email = $cf7->posted_data["contact-email"]; $article_title = $cf7->posted_data["article-title"]; $article_content = $cf7->posted_data["article-content"]; $article_modality = $cf7->posted_data["article-modality"]; $article_speciality = $cf7->posted_data["article-speciality"]; $article_categories = array(); $article_categories[] = 17; foreach ($article_modality as $modality) { $article_categories[] = get_cat_ID($modality); } foreach ($article_speciality as $speciality) { $article_categories[] = get_cat_ID($speciality); } $my_post = array(); $my_post['post_title'] = $article_title; $my_post['post_content'] = $article_content; $my_post['post_status'] = 'draft'; $my_post['comment_status'] = 'open'; $my_post['ping_status'] = 'closed'; $my_post['post_author'] = 1; $my_post['post_category'] = $article_categories; $new_post_id = wp_insert_post( $my_post ); update_post_meta($new_post_id, 'Contact_Name', $contact_name); update_post_meta($new_post_id, 'Contact_Email', $contact_email); }
Thanks for the prompt reply.
I figured it would probably be an array. What is the structure of the array? Do you have any code to extract the values e.g. from the send email script? I’ve looked through the plugin code and can’t find any. (I can do basic coding/development but still learning! hence asking for some more detailed explanations).
On a related matter, the checkbox fields are used to assign categories to the new post. I am manually entering the text in the CF7 form editor. Is there a way to do this via php/wordpress functions in the form editor?
Many thanks,
MarkForum: Plugins
In reply to: Contact Form 7 – Generating Reference NumberHave you looked at the wpcf7_before_send_mail hook?
You might be able to add another field for the reference. An easy way to get a unique reference is base it on the date & time.