I'm trying to create a means of user input calculation, where input fields and calculation formula are set dynamically. For example, a have Number of apples and Price for one apple inputs, so I multiply inputs to get the price. In another case I have length, width and height inputs to calculate volume.
I decided to store inputs, data and calculation function and reassemble the form form json with Alpacajs
But calculation fields are only a part of a bigger form. So using
$("#alpacaForm").alpaca(window.alpacaForm.object);
adds a new form inside the alpacaForm
element.
Is there a way to append fields generated by alpacajs to an existing form?
The only way I've managed to do it is by rendering into a separate element and copying the elements over.
For example:
The JavaScript (and jQuery):
I was hoping to find an Alpaca option to prevent needing to do all this, but there doesn't seem to be one.