Support » Plugin: Wordpress Forms » [Plugin: WordPress Forms] Created the form, got it into a post, now what?

Viewing 1 replies (of 1 total)
  • Plugin Author Vitor Carvalho

    (@lightningspirit)

    Hi!
    Yes you need a webservice to calculate your inputs and given it back to forms response.
    Wordpress Forms itself can’t handle this kind of calculations, but you can wright a function in your functions.php in theme directory:

    function calculate_submitted_data() {
    // do the maths calculations for $_POST variables. Search in google for php $_POST for more info
    die('Result is: ' . $variable_with_the_math_result);
    }

    and add those lines:

    // Ajax from form for calculation
    add_action( "wp_ajax_calculate_submitted_data", 'calculate_submitted_data' );
    add_action( "wp_ajax_nopriv_calculate_submitted_data", 'calculate_submitted_data' ) );

    Now in URL parameter in Form Options box insert this link:
    /wp-admin/admin-ajax.php?action=calculate_submitted_data

    For now on your form will be processed by your function.

    I have not test it but I this algorythm many times, so it should work nicely 😉

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WordPress Forms] Created the form, got it into a post, now what?’ is closed to new replies.