Repeater area: Keep first entry

Prevent users from deleting the first entry in a ChronoForms repeater area.

Overview

The standard repeater allows removal of all entries, including the initial one.
Add the first entry as a static part of the main form and use the repeater only for additional entries. Alternatively, use custom JavaScript or hide the repeater initially with a checkbox event.

Answered
ChronoForms v6
pa pat01 06 Sep, 2019
Hi
​
I did have a look at your demo repeater form.
​
There it's possible to add more "Guests" and remove them as well.
​
Is there a way to prevent removing the first entry "Guest 1"?

Users should only be able to remove additional "Guest", but not the first one.
​
Thanks.
​
Patrick
Gr GreyHead 06 Sep, 2019
1 Likes
Hi Patrick,
​
The simplest way to do this might be to add guest 1 to the main form and use the repeater from guests 2 . . . and on. It's probably possible to add custom JavaScript to stop the first one being deleted but that might be ore complicated to do.
​
Bob
pa pat01 07 Sep, 2019
Hi Bob
​
Thank you.
​
Disadvantage would be, that there are two Guests on form load, instead of just one.
​
But at least it would not be possible to remove first guest.
​
Patrick
Gr GreyHead 07 Sep, 2019
Hi Patrick,
​
Can you hide the whole multiplier until the user checks an Add more Guests checkbox?
​
Bob
pa pat01 07 Sep, 2019
Hi Bob
​
Unfortunately the Repeater area has no "Events" tab, so I can't do that.
​
Patrick
Max_admin Max_admin 21 Sep, 2019
Answer
1 Likes
You can hide the repeater with an event in the checkbox with target id as the repeater area id
​
Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.