Home › Forums › Quform WordPress › Post value
- This topic has 13 replies, 2 voices, and was last updated 8 years, 4 months ago by Nitrat.
- AuthorPosts
- December 24, 2015 at 8:54 am #17730NitratParticipant
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?December 28, 2015 at 11:27 am #17734AllySupport StaffYou 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.
December 28, 2015 at 11:30 am #17735NitratParticipant200 – this is the price that must be replaced periodically. I think to do this by updating the value of post
December 28, 2015 at 11:40 am #17736AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
December 28, 2015 at 11:43 am #17738NitratParticipantFunction my_pre_display($form)…Where exactly write this code?
December 28, 2015 at 11:45 am #17739AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
December 28, 2015 at 11:48 am #17740NitratParticipantMy 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’);December 28, 2015 at 12:02 pm #17742AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
December 28, 2015 at 12:19 pm #17743NitratParticipantDont 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>
December 28, 2015 at 12:51 pm #17745AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
December 28, 2015 at 2:39 pm #17747NitratParticipantSend
December 29, 2015 at 3:16 pm #17750NitratParticipantmy letter came?
December 30, 2015 at 9:15 am #17753AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
December 30, 2015 at 9:24 am #17754NitratParticipantWow! thanks!!!
- AuthorPosts
- You must be logged in to reply to this topic.