Hey ckpicker and Takayuki Miyoshi the information you’ve shared is very helpful. Thanks.
I think I’m a step or two from successfully using the on_sent_ok action hook in my ‘additional settings’ to redirect a forms to a different page depending on which value is selected in a drop-down field.
I modified the scripts.js file replacing line 48;
if (1 == data.mailSent) {
$(data.into).find('form').resetForm().clearForm(); ro.addClass('wpcf7-mail-sent-ok');
if (data.onSentOk) $.each(data.onSentOk, function(i, n) { eval(n) }); } else {
with the code Takayuki Miyoshi provided.
if (1 == data.mailSent) {
jQuery(data.into).find('form').resetForm().clearForm();
wpcf7ResponseOutput.addClass('wpcf7-mail-sent-ok');
if (data.onSentOk)
jQuery.each(data.onSentOk, function(i, n) { eval(n) });
} else {if (1 == data.mailSent) {
if (data.onSentOk)
jQuery.each(data.onSentOk, function(i, n) { eval(n) });
jQuery(data.into).find('form').resetForm().clearForm();
wpcf7ResponseOutput.addClass('wpcf7-mail-sent-ok');
} else {
The good news is I don’t receive the Null value any more when send is clicked.
The bad news is when send is click it does not redirecting to the page I want it to go to. It comes back to the form page.
I think the problem maybe something basic Maybe I’m not using custom fields correctly.
This is the site. https://www.emekayoga.com/?page_id=11
This is the code I put in my Contact form 7 additional settings box
on_sent_ok: "alert('Unique2 ' + jQuery('#Unique2').val());"
When unique2 is selected and send is click I would like it to redirect to another page.
I need a code doctor