Post value

Home Forums Quform WordPress Post value

This topic is: resolved
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #17730
    Nitrat
    Participant

    Hi!
    How to transfer the value of the post in the formula? For example, the post is 200. Total is calculated by the formula = 100 * Price. Price should be set to 200. How?

    #17734
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    • This reply was modified 8 years, 5 months ago by Ally.
    #17735
    Nitrat
    Participant

    200 – this is the price that must be replaced periodically. I think to do this by updating the value of post

    #17736
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #17738
    Nitrat
    Participant

    Function my_pre_display($form)…Where exactly write this code?

    #17739
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #17740
    Nitrat
    Participant

    My post id = 194 and a hidden field called “price” (iphorm_1_7). This code is correct?
    function my_pre_display($form)
    {
    global $post;
    $price = get_post_meta($post->ID, ‘194’, true);

    $form->setValue(‘iphorm_1_7’, $price);
    }
    add_action(‘iphorm_pre_display_1’, ‘my_pre_display’);

    #17742
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #17743
    Nitrat
    Participant

    Dont work :

    <div id=”form-total”></div>
    <script>
    jQuery(document).ready(function ($) {

    var calculate = function () {

    var gr = $(‘.iphorm_1_2’).val();
    var pri = $(‘.iphorm_1_7’).val();
    total = gr* pri;

    total = total.toFixed(0);
    total=(total.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, ‘$1 ‘));

    // Display the result to the user

    $(‘#form-total’).text(‘Примерная стоимость: ‘ + total+’ руб.’);

    // Set the value of the hidden field

    $(‘input[name=iphorm_1_4]’).val(total);
    };

    // Пересчет при загрузке страницы
    calculate();

    // Recalculate when these text input fields are changed
    $(‘.iphorm_1_2’).blur(calculate);

    });

    </script>

    #17745
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #17747
    Nitrat
    Participant

    Send

    #17750
    Nitrat
    Participant

    my letter came?

    #17753
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #17754
    Nitrat
    Participant

    Wow! thanks!!!

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy