Forums

CC6 - Form field call a function

Roaf 07 Aug, 2018
Hi, I have made a confirmation screen for orders, with the ability to edit an order.

When an administrator goes to edit an order, they are given a screen of that order's form fields which I have set up. What I wanted to be able to do is when they select a new product or item, it would recalculate the price based on the item selected from a drop down. I cant figure out how to make an onselect event run a php script to update the total field.

Has anyone done this? Essentially, I want to run php script from a form view when a selection is made.
healyhatman 09 Aug, 2018
1 Likes
Should work exactly the same way as in ChronoForms, when you reload a field. If not, just use a jQuery AJAX call.

Inside a DOM.ready
jQuery('#element').change(function(myfunction));


Inside a normal JS block
jQuery.ajax({
data: {...},
type:"POST",
url:"{url:event_where_script_is}&tvout=view",
success: function(result) { (whatever it is you want to do, probably jQuery('#fieldtobereplaced').html(result); }
});
This topic is locked and no more replies can be posted.