I am creating a form where I have a total field. Instead of having the user enter it, I want the fields amount and quantity to multiply each other and update the total field.

this is easy enough to do in Javascript, but I'm not sure how Drupal would prefer it be done. I'm also not positive how to add an on_update call to the fields in a drupal form.

I usually end up doing my tasks the hard way so thought I'd ask early and see if anyone could point me in the right direction for how to do this in Drupal.

thanks,

Comments

dianikol’s picture

I would do it using AJAX with forms. Examples modulehas a lot AJAX examples with forms. Take a look. If you create any code and having problem with it post it :)