I have a View with editable fields showing line items (rows) each with a value. The user has to divide the value number into two, a share for them and the balance for someone else. I want them to be able to enter either the percentage or the amount of their share. The tricky part I can't figure out is how to have the percentage or amount field change to match when they change the other. I can do the change processing but can't find a way to force the alternate input field to match the change. I need to do this in Views (otherwise I could take care of this in JavaScript) and record the change back to the database.

For example, say the value is $200 and the default share is 50% and 50%, so each gets $100. I need my user to be able to change the percentage to say 30% and have their share then show $60, or if they prefer change their amount to $60 and the display change to show 30% in the percentage field.

I can't find a module or field type to do this. Any suggestions are very welcome as I'm stuck.

Comments

hondaman900’s picture

Another perspective - I can accomplish this if I could determine which field (amount or percentage) was last changed, and use it to calculate the result. It's a sequencing issue and with Views. Without live on-screen programmatic control to capture and evaluate user input as it's entered (such as when the edit box loses focus), I can't determine which field was last edited and therefore should drive the calculations.

Is there an Ajax way to do this live and then commit the result, Rather than relying on a complete callback cycle to do the math and process the results?

Thanks in advance for any help with this...