Enter your username and password below to login. Forgotten your password? Click the link below to reset it.

By: Dev S | Asked: 02/06/2023

I have two rows with numbers (the example in the screenshot is , the quantity of numbers varies from 1 to 6). I need to dynamically find the difference between the quantity of these numbers (assuming that the first row always has more numbers than the second) And after that, find the sum of the numbers that are filled in the first row, but not filled in the second (that is, in the example shown in the screenshot, there are no numbers in the last two cells in the second row, but there are in the first row. That is, I need to find the sum of the last two cells of the first row. The answer will be 90). How can I implement this?
Thanks in advance :) :)

2 Answers

You need to do this in jQuery. You don't mention the type of field you're using to capture the rows of numbers. It makes a difference in the jQuery code. Please explain with more form construction details.

Thanks for your reply, Victor. Here's more specifics.
1) So - I have two fields. Let's say the field X and Y for which the values I need to enter are between 1 to 5. But Y can't be X.
2) Based on the input, I will have more fields added to the calculation. Let's say if X = 3 and Y = 1, I will have 3 fields related to X and 1 field related to Y.
3) After that, the user will fill in these 4 fields (3+1) and I need to find the sum of the last two numbers by which 3 is greater than 1. That is, in this case, the sum of the last two fields. Or let's say If X is 4 and Y is 1, then I need to find the sum of the last THREE values.

Please login or Register to submit your answer

- Automatically jump to form's next step when selecting radio button option asked by Sergio Giannone
- File Upload not working asked by John Perrelli
- Adding a URL to View post content section asked by Gerry Bolger
- Plugins That Rock! asked by Chris Adams
- JQuery DataTable Shortcode Snippet for HTML Table Views asked by Walter Jones

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!

Join the community