WordPress contact form 7 redirection - wordpress

I want redirect contact us form 7 , for different pages,
I have multiple custom posts, and I want that when the user wants to read this, then first fill a form, and then redirect to full page. I want this process for every single post.
My test case can be seen here.
I am doing this:
on_sent_ok: "location.replace('http://polestarllp.com/casestudy/benefits-of-sql-on-hadoop/');"
But this is for only one page.

If it doesn’t work, check if Ajax is correctly working on your site.
follow this link
http://contactform7.com/redirecting-to-another-url-after-submissions/

For redirecting your contact form after submission . This is perfect method ,
on_sent_ok: "location.replace('http://polestarllp.com/casestudy/benefits-of-sql-on-hadoop/');"
But if you getting any issue then you can use redirection addon for contact us plugin .may be these link help you.
1:https://wordpress.org/plugins/tags/redirect-cf7/
2:https://github.com/anup04sust/Contact-Form-7-Redirect/blob/master/contact-form-7-redirect.php
3:https://github.com/kasparsd/contact-form-7-extras/blob/master/plugin.php

you need to call post id instead of this link ('http://polestarllp.com/casestudy/benefits-of-sql-on-hadoop/')
on_sent_ok: "location.replace('<a href="'. get_permalink($post->ID) . '"');"
hope it will work for you

Related

Contact Form 7 Redirect in Thank you page By post ID or URL for Tracking Goal

I want to redirect my contact Form 7 redirect to Thank you page by Post ID or Post URL. That's why I can track my Conversion Goal for an individual post.
For Extample: I have Project details page and here only one contact from. So it can redirect just one Thank you page. but I need thank you page for every single project and that may be used ID or URL.
How can I do this?
Use this code to redirect contact form on thankyou page :
document.addEventListener( 'wpcf7mailsent', function( event ) {
window.location = 'www.pageurl?id=33';
}, false );
You need to put this code where you have added contact form. just create a single thankyou page, to identify page/post you can pass id in the url parameter www.pageurl?id=33

WordPress Plugin development and 404 error

I have created some custom pages for my plugin, also I have a form which is submitted from the front-end. But, when submit button of that form is pressed, it redirects me to 404 page. After updating permalinks to "post-name", it works but all I want is that the form submit should properly work no matter what sort of permalink is set at the settings.
Some help on this will be highly appreciated.
Thanks!
use the normal link while submitting yourwebsite.com/?p=2 format this will work irrespective of permalink structure
One can use like this: action="<?php echo get_permalink( get_page_by_path( 'page-id' ) ) ?>" in the front-end form. Caution: page must exist.
Thanks!

I'm trying to integrate PayPal Payment with Contact Form 7 in WordPress, and my Redirect isn't working

I'm working on a Charity site where we want to accept membership payments and donations via paypal.
I am having a problem with Contact Form 7 and redirection to PayPal with a variable payment amount. I'm really hoping that someone can assist or shed some insight on this problem for me.
I read This Post, which made it sound quite easy but, while my email is being sent, the form isn't redirecting to PayPal, in fact it's not doing anything at all, not even giving me the "thank you your form has been submitted" notice.
my form has this line: £[text* AmountPaying 6/ id:PayingThis]
And under "Additional Settings" I have inserted this:
<script>
function my_redirect() {
var price = document.getElementById("PayingThis").value;
var url = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=#####&currency_code=GBP&amount="+price+"&return=http://www.example.org/join-or-renew-your-membership-online/";
window.location = url;
}
</script>
on_sent_ok: "my_redirect();"
does anybody have any experience with this ?
Thanks for the comments !
With some help troubleshooting from a friend I have figured out how to make this happen with contactForm7 - in fact, I believe you could extend this solution, and submit a lot of dynamic information directly to PayPalmy problem.
This is what I did - and it's essentially the same as this guy does here
BUT, instead of putting that code in the "ADDITIONAL SETTINGS" Area of the CF7 Form page - I added this:
<script>
function my_redirect() {
var price = document.getElementById("PayingThis").value;
var url = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=#######&currency_code=GBP&amount="+price+"&return=http://www.example.org/join-or-renew-your-membership-online/";
window.location = url;
}
</script>
up at the top, with the rest of the Form building html and tags, just before the code for the form itself:
Your Name (required): [text* your-name]
etc.
and then in the Additional settings box.. I only called the function
on_sent_ok: "my_redirect();"
and it worked! it takes the value the user enters in the "How much do you want to give us" box, and submits it to paypal
I hope others can benefit from this
thanks again for taking the time to view and help
-5tratus
Contact Form 7 is a great plugin but creating a form for PayPal gets a little tricky. Gravity Forms would be a great options but you would need the developers license that cost $200.
My recommendation is to look up the PayPal form API and create the form yourself, from scratch and integrate it OR you should have a look at the Advanced Custom Fields plugin, and the PayPal Field Add-on for Advanced Custom Fields! It's all free.
It enables you to set a form on any post/page/etc with a paypal button. All you have to do is add the <?php the_field('NAME_OF_YOUR_FIELD'); ?> to your template, wherever you want to display it.
http://wordpress.org/plugins/advanced-custom-fields/
http://wordpress.org/plugins/advanced-custom-fields-paypal-field/
Thanks 5tratus. Works.
An old support thread (https://wordpress.org/support/topic/contact-form-7-paypal-integration-1) was getting as far as redirecting to PayPal, but then PayPal was giving an "Page Not Found" "You have requested an outdated version of PayPal" message.
I didn't need price or any extra variables, so I cleaned it up to just redirect to the product page. Here's what I used and it works:
<script>
function my_redirect() {
var url = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=[PUT YOUR BUTTON ID HERE]";
window.location = url;
}</script>
As 5tratus says, put the above code in at the bottom of the form code itself, then put
on_sent_ok: "my_redirect();"
in the "additional settings" part.
Refer this useful plugin - https://wordpress.org/plugins/contact-form-7-paypal-extension/

wordpress contact 7 URL Redirect with target=_blank

i wan to redirect my form after submit it i found the code which will do that
on_sent_ok: "location.replace('http://www.YOURSITE.com');"
but here is the twist i want redirect url with target blank .it means when visitor submit a form it will open a new page with target="_blank" link in contact 7 form of wordpress
please help me in it
Thanks
You have to use client-side code, like javascript.
hope this code helps
<?php
if(condition==true) {
?>
<script>
window.open("http://www.example.com");
</script>
<?php } ?>
I can't add comments. but just to clear this: if You use Contact Form 7 plugin you just need to paste the following in Additional settings tab of your form:
on_sent_ok: "window.open('http://example.com/');"
http://example.com/ is your URL off course.
But note, that you may have problems with browser popup settings,
because new tab is opening without user action/permission.

add simple texts to drupal contact form

I'm building a site and it has a contact page . the contact page uses contact module and it has some basic forms , what I want is to add some simple text like my personal email and phone number and ... to this page , but I couldn't find a way to do it . I'll be appreciated if you can help me with this
thanks
//--------------------------------------------------
finally found the answer! I made a file named "page--contact.tpl.php" and from there after
<?php print $feed_icons; ?>
I just wrote whatever information I wanted and it worked!
My suggestion ditch the contact form and go for Webforms You will thank me in the long run.
You can also create a block, add it above or below the form, then add your information to it. Simplest solution if you all you need is an area to add some details.
You can implement hook_form_alter() and then you can do whatever you want with the contact form.
See http://www.lullabot.com/articles/modifying-forms-drupal-5-and-6 and http://www.metaltoad.com/blog/how-add-field-drupal-contact-form

Resources