I have to design a form with one field being a quantity that represents the number of available items of a given product. I want to allow the user to modify this quantity in 2 different ways, in the same form: they can set directly a new quantity, or they can specify an amount to add/substract to the original quantity.
I thought two input fields could define the operation in the following way: one is for the amount to add/substract, and the other is for the result. If the user modifies one the other gets updated. In the end the value submitted is the value of the "result" input field. Negative numbers are allowed. One quick implementation of this for illustration:
Am I on the right track or is there a common pattern to do this in another way? Maybe it shouldn't be possible to use the 2 modes of operation at the same time, so the user should be able to select from an "exact mode" or a "delta mode"?