Forums

how to control area_repeaterx.key

samir1903 06 Jan, 2019
i have reapeater area to evaluate students

i put in html widget in the area repeater this code
<div class="ui segment" style="background-color:#EFF1ED">
<h4 class="ui header" style="color:black;">Evaluation student {var:area_repeater309.key}</h4>
</div>
this code is working but it starts with ecaluation students 0 and when i eliminated a student it lost sequence like student0, student2 if student1 is elimanated in this sequence
i want like student1,student2, even second student is elimaneted in this sequence
???
i think i need a variable but i dont know how to control this variable in design and assign this variable to eliminate and new student
healyhatman 06 Jan, 2019
Answer
Much easier to just do it on the backend than to try redoing the key on the frontend.
samir1903 24 Jan, 2019
i am not clear about how to do it backend?
i solve the other situation with loop email through db read after db save

but this one still make useers confusing a lot?
healyhatman 24 Jan, 2019
Just ignore the numbers on the front end, redoing the sequence when removing a repeater entry would be very difficult you have to rename all the fields and segments and rebind all the actions it's not worth the effort. I wouldn't even display the repeater key to the user.
GreyHead 25 Jan, 2019
Hi samir1903,

In the FAQs there is an example from CFv5 using JavaScript with a multiplier to manage the sequence when an entry is removed. I imagine that you could write something similar for CFv6. Basically it ran a function triggered by the multiplier Add and remove buttons (plus a short delay to let the addition/removal complete). The function scanned the HTML and kept a list of the IDs of the current items and updated records as necessary.

Bob
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger