In my application I need to have the value placed into one field to be the result of a calculation based on values in two other fields. I tried to do this with the following jQuery:
Code:
<script type="text/javascript">
$(function () {
$("input[type='text']").change(function () {
var unitNetPrice = (this.value);
var quantity = $(this).prev().prev();
var netPrice = quantity * unitNetPrice;
$(this).next().next().attr('value', netPrice);
});
})
</script>
I was hoping that this would fire while the user is in Edit mode on the row and after the user has entered the "unitNetPrice". It also assumes that the user has already entered "quantity". But nothing happens. Is there a small glitch in this approach or is this not the way to approach this?
Another problem I just noticed is how to validate the user's input. When I enter the DataFormatString, that is what is displayed in the non-edited rows instead of the actual data.