I am doing some work for a client at work and I am very poor at javascript and ajax.
I am working on a system that generates a very dynamic frontend. The admin can create forms on the fly and some functions generate them on the frontend. My job is to use information from these forms. I have managed to get the forms appearing on the frontend, but I need to make the price at the bottom of the form to update as the form fields are updated. Someone has suggested jQuery.
Basically, I need a javascript/ajax function that will do an onChange event for each selection that will update the price. Unfortunately I cannot target individual input fields (with an id for example) because the input fields are dynamic. I was going to create a separate php file that will calculate the new price by submitting the total value of the form at each selection and this will be accessed via ajax at the onchange event.
To further worsen the situation, the "value" of the form fields is not the price. I can get the functions that generate the price and I can sort that out with PHP. I just need the ajax calls that will update the price each time any field is changed. That is, submit the form to the price generating script. Then I can use the array that it returns to update the price. The client absolutely wants this to be ajax, no reloads. Therefore this onchange event will have to apply to all items within the form.
I am working on a system that generates a very dynamic frontend. The admin can create forms on the fly and some functions generate them on the frontend. My job is to use information from these forms. I have managed to get the forms appearing on the frontend, but I need to make the price at the bottom of the form to update as the form fields are updated. Someone has suggested jQuery.
Basically, I need a javascript/ajax function that will do an onChange event for each selection that will update the price. Unfortunately I cannot target individual input fields (with an id for example) because the input fields are dynamic. I was going to create a separate php file that will calculate the new price by submitting the total value of the form at each selection and this will be accessed via ajax at the onchange event.
To further worsen the situation, the "value" of the form fields is not the price. I can get the functions that generate the price and I can sort that out with PHP. I just need the ajax calls that will update the price each time any field is changed. That is, submit the form to the price generating script. Then I can use the array that it returns to update the price. The client absolutely wants this to be ajax, no reloads. Therefore this onchange event will have to apply to all items within the form.