• Resolved MrSco

    (@mrsco007)


    https://calchub.xyz/documentation/#wpcf7

    I’m having issues trying to submit a contact form that includes a calculation result. The documentation doesn’t go into much detail. Can you please expand?

    currently i’m using this html template…

    <label> Email

        [email* your-email autocomplete:email] </label>

    <label> Calculation Result

        [textarea* your-result class:wpcf7-calculator-result] </label>

    [submit “Submit”]


Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor calchub

    (@calchub)

    Hello.

    You need install the add-on https://calchub.xyz/downloads/calculator-builder-add-on/

    The CalcHub WPCF7 in the section Extensions

    Thread Starter MrSco

    (@mrsco007)

    thank you

    Thread Starter MrSco

    (@mrsco007)

    Is there a way to control what result data ends up in the contact form text field? I’d like to send formatted html so it presents in the email nicely

    Plugin Contributor calchub

    (@calchub)

    Sorry but in the current version it’s not possible, but I plan to add this option in the next version of the add-on

    Thread Starter MrSco

    (@mrsco007)

    ok. i look forward to it.

    in the meantime as a workaround, is there a php filter I could put in functions.php that could intercept the email message and massage it?

    Plugin Contributor calchub

    (@calchub)

    Sorry, but no (

    Thread Starter MrSco

    (@mrsco007)

    I think I found a workaround… I’m still working on it, but maybe it will help someone else who searches and finds this thread. cheers!

    
    add_action( 'wp_enqueue_scripts', 'ut_child_theme_enqueue_styles' );
    
    
    add_action( 'wpcf7_before_send_mail', 'format_calc_results', 1 ); 
    function format_calc_results( $contact_form ) {
        $wpcf7 = WPCF7_ContactForm::get_current();
    	// to get form id
        $form_id = $contact_form->id();
    	// only mess with calculator contact form
        if($form_id == '2697' ) {
    		$submission = WPCF7_Submission::get_instance();
    		if ($submission) {			
    			$data = array();
    			$data['posted_data'] = $submission->get_posted_data();
    			$calc_results = $data['posted_data']['your-result'];
    			$mail = $wpcf7->prop('mail');
    
    			if($calc_results != '') {
    				$calc_results = 'blah';
    				$mail['body'] = str_replace('[your-result]', $calc_results, $mail['body']);
    			}
    
    			$wpcf7->set_properties(array(
    				"mail" => $mail
    			)); 			
    		}
    	}
    	return $wpcf7;
    }

    • This reply was modified 1 year, 1 month ago by MrSco.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Contact Form 7 Integration’ is closed to new replies.