Buy Now
Sign in

CC6 - Form field call a function

Roaf , August 07 at 20:34
R
Roaf
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
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); }
});
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman