I’m using ACF to create a tuition planner. The fields will include a Total tuition fee field, a Deposit field, and a Number of installments field (a drop-down with values from 2 to 12). And finally a repeater field with fields: Installment amount, Due Date, Paid (a checkbox), and Date of payment.
Ideally, what I’d like is a way to create and pre-populate the Installment amount fields of the repeater as soon as the admin selects the number of installments from the drop-down (if, of course, the Total tuition fee field and Deposit field are already filled in.
Of course, you understand the logic, that the JS invlolved will subtract the deposit from the total, then divide it by the number of installments, and that amount will pre-populate the Installment amount of the repeater rows (the rows will be, of course, the same number as the Number of Installments selected in the drop-down.
I’m not interested in the JS part that will “listen” to the change event of the Number of installments drop-down… Nor the arithmetic calculations of the amount of the installment – that’s the easy part…
I’m interested in a way to dynamically create the repeater rows. I assume it will have to be something that will trigger the methods involved when the Add row button is pressed, but I’ve never done it before, so I thought to ask here before I dig into the code to find out the hard way how it’s done by ACF.
Any help will be very much appreciated. TIA.
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users