Disable email if input value is selected
-
I have a problem with Contact form on wordpress. I would send the email only if a specific input field is selected.
I wrote this function:
add_action( 'wpcf7_before_send_mail', "wpcf7_disablEmailAndRedirect" ); function wpcf7_disablEmailAndRedirect( $cf7 ) { // get the contact form object $wpcf7 = WPCF7_ContactForm::get_current(); // redirect after the form has been submitted $wpcf7->set_properties( array( 'additional_settings' => "on_sent_ok: \"var Iso = $('input[name=radio-814]:checked').val() ; if(Iso == 'value1' ){ location = 'https://www.paypal.com/'; } if(Iso == 'value2' ){ location = 'https://test.it/acquista';}\"", ) ); }
but the email starts, I want to avoid sending email if input with value “value1” is selected. If I select “value2” the email must start.
How can I do? Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Disable email if input value is selected’ is closed to new replies.