In case anyone is still awake:

Drupal.behaviors.compute_items = function() {
    $(".line-item-quantity").bind("change",function() {
      // The id of this should be edit-quantity-ID so we use replace
      var id = $(this).attr('id').replace('edit-quantity-', '');
    //  alert('edit-quantity-' + id);
      var quantity = $('edit-quantity-' + id, this).val();
      alert(quantity);
      var price = $('edit-price-' + id).val();
      alert(price);
      var subTotal = quantity * price; // Do your actual calculation here.
        alert(subTotal);
      subTotal = isNaN(subTotal) ? 0 : subTotal;
        alert(subTotal);
      $('edit-subtotal-' + id).val(subTotal);
      alert('edit-subtotal-' + id);
    });
};

quantity and price are returning *undefined*.

Thoughts?

--
Karyn Cassio
Drupal Developer
303-981-4161



On 2/21/10 8:55 PM, Earl Miles wrote:
Adam Gregory wrote:
As a note the change event is really on valid on things like select elements and I think radios/chackboxes, but doesn't work on textfields/areas.

It actually does work on textfields, but only when your focus leaves the textfield. (not sure about textareas). To get instant updates there's always keydown which will make the function fire whenever a key is pressed within the textfield.


Reply via email to