On Dec 18, 10:09 pm, Truck Estevez <oohtr...@gmail.comwrote:
Right, thats a great example but I have php doing all my calculations
and I really don't want to re-write the whole thing in javascript...
am I screwed or is there a way to integrate my php calculations with
the js?
You did not say that you want to make any PHP integrations. All you
said was "I'd like it so the form dynamically changes these totals
depending on the value of the dropdowns/checkboxes", that is what this
nice sample by Bart Van der Donck is about. For the quoted question
yes, you are kind of screwed because PHP is run server-side and
Javascript is run client-side and they have no native runtime
connection whatsoever. You may of course attach event listeners to
form elements and onchange use XMLHttpRequest to the server to get the
calculation result so to update relevant form fields (kind of RMI/
WebService path). But if it's nothing than simple cost/total/tax etc.
calculations then such approach is hugely ineffective IMO. Just use
Javascript alone. Other option is to keep everything server-side and
provide "Recalculate total" or similar submit button in the form to re-
submit the form every time user wants to see the results of her
selections. You also may use Javascript solution for automated updates
client-side and normally hidden <noscriptblock with "Recalculate
total" or similar submit button in case if the script support is
disabled.