WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Forms
[resolved] Created the form, got it into a post, now what? (2 posts)

  1. rughooker
    Member
    Posted 3 years ago #

    Downloaded the plugin, created a form and inserted into a post. Easy!

    My original post that led me to this plug-in.

    I can enter the data and it says form submitted. I think I need a function now. I'm not a programmer, but I survive by cut and paste and minor modifications. What is the general format? Just need a template that I can modify. I know nothing of AJAX.

    Am I using the right plug-in? Looks perfect so far.

    http://wordpress.org/extend/plugins/wordpress-forms/

  2. Vitor Carvalho
    Member
    Plugin Author

    Posted 3 years ago #

    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 ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic