• Resolved Laurens Hoogland

    (@laurens-hoogland)


    Hey hello,

    We use the WP Ride booking plugin to calculate distance and total price of a transport.
    After the client calculated these 2, he can open a modal, with a CF7, to send a request for said transport.
    I would like to dynamically send the two values which are calculated in the previous input form. #distance and #total_price
    How can i do this?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author sevenspark

    (@sevenspark)

    Hi Laurens,

    The CF7 DTX dynamic values are shortcode-based, which means values are generated exclusively on the server side of things.

    If all of this is happening on the client side (in the browser), then unfortunately this plugin won’t help.

    If you are sending the value to the server and retrieving the form dynamically, then you could potentially insert that value dynamically using the CF7_POST shortcode, for example. If the data you want to include isn’t sent to the server, or your modal form loads with the rest of the page (as it probably should), then this won’t be useful.

    Most likely what you’re looking for is a javascript solution. Should be pretty simple to write up with jQuery to just listen to those two value changes and update the form field.

    Hope that helps ??

    Hi,
    I have a someone related question that i know im super close on, however not really sure where to go from this point. so my goal is to capture to the millisecond, when the form is being email/or submitted. I am able to capture the time successfully and precisely and display its output in a div, but i dont know how to get that value to be set to a element in the form and send to include in the email(my logic is that this would actually have to delay the form from being sent for a bit, im trying to capture the time they hit submit, which i guess cf7 is actually recording the time the email is successful processed and sent off, see what im saying?)
    I use the below code to get the submission to the millisecond and display that in a div with id demo:

    <script type=”text/javascript”>
    document.addEventListener( ‘wpcf7submit’, function(){
    var d = new Date();
    var x = document.getElementById(“demo”);
    var h = addZero(d.getHours(), 2);
    var m = addZero(d.getMinutes(), 2);
    var s = addZero(d.getSeconds(), 2);
    var ms = addZero(d.getMilliseconds(), 3);
    x.innerHTML = h + “:” + m + “:” + s + “:” + ms;
    },false);
    function addZero(x,n) {
    while (x.toString().length < n) {
    x = “0” + x;
    }
    return x;
    }

    </script>

    Any help would be awesome!!! also a concern is the security of this, as the timestamp cant be altered maliciously, so maybe do this server side?? i really dont know.

    Thanks,
    -Mike

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Form Data in CF7’ is closed to new replies.