Im creating a dynamic form, using FORM API. Several lines of results, fetched from DB, and several functionnalities like deleting a row, adding a row, modifying quantites and calculating total prices.
I did everything using ajax callback, but Im not sure this is the best way of doing it, especially with the 'change quantities' and 'calculating prices' functionnalities.
What I understand about AJAX Callbacks is that a full refresh of the form is done during callback (using cache if possible), and that alony a certain part of the form is returned (using return $form[XXXX]
).
So when I change a quantity input field, the form is rebuild, and Im updating the price col and total.
The question im asking to myself is : should I use simple javascript to manage my prices when quantities change ? For me its seems more logical, avoiding by the way useless PHP requests.
As Im not sure about it, likely to forget something important, I prefer asking it to you guys. Thx !