PHPRad Classic Initial 2.7.3 Forum

PHPRad Forum => Questions => Topic started by: maumar on September 15, 2020, 08:18:19 PM

Title: PERFORMING CALCULATIONS ON DYNAMIC TABLE ROWS
Post by: maumar on September 15, 2020, 08:18:19 PM
Dear Sir @willvin I appreciate your help. If possible  please  help me about this issue . While I was using static table the following code was working perfectly to multiply two values i-e rate & quantity and result was displayed on third field invoice_rate .  But after using Dynamic Table Row it is not working. Thanks & Regards...

Code: [Select]
$(document).ready(function() { $("#ctrl-rate,#ctrl-quantity").keyup(function () { $('#ctrl-invoice_rate').val(($('#ctrl-quantity').val() * $('#ctrl-rate').val())); }); }); 
Title: Re: PERFORMING CALCULATIONS ON DYNAMIC TABLE ROWS
Post by: willvin on September 16, 2020, 01:38:04 PM
@maumar‍ that is because you are using the wrong field id, since you changed it to Dynamic Table Row the id of the field is different. The id would be in #ctrl-rate-row1, #ctrl-quantity-row1, #ctrl-rate-row2, #ctrl-quantity-row2, etc. The best solution is for you to do your calculation with PHP in Page Events before it is inserted into the database, or you change back to the single form.