How to reset repeating group after listing submissions?

Hello,

I have a repeating group containing dates added by the user. The user can then ‘submit’ their listing, and those dates are saved, however, when they create a new listing, the dates they added for other listings are still visible.

I’m trying to tie dates to individual listings and not have them migrate over to other listings.

Here’s what the date repeating group looks like (dates are added from the ‘add a date’ popup):

I’ve tried a few different things such as resetting inputs after submitting a listing (working for normal inputs, but I guess the RG isn’t an input), resetting the repeating group itself and resetting the ‘data’, but when I create another listing, the old dates I added are still there.

I did fix 1 issue - the dates I added would be visible for anyone creating a listing, but the source for my RG is ‘Do a search for CalendarSchedulings’, with a ‘Created by = Current User’ constraint, so that has stopped me from seeing dates added by other users at least.

A bit stuck right now!

Public link: [Removed as solved]

If you’d like to use a test account, you can use these login details:

Username: test@test.com
Password: test

Thanks

I would add a new field to CalendarScheduling called status.

When you create them on the page, give them a “Draft” status.

On Page Load delete all CalendarScheduling that have been created by this user, and have a Draft status.

On “Save List” update all the CalendarSchedulings using make changes to List. Update Status to “Live”.

1 Like

Edit: I’ve now fixed this!

It seemed that ActivitySchedule2’s List of CalendarSchedulings wasn’t working well, so instead I used ActivitySchedule’s List of Dates along with the page reload delete workflow, and that seems to have worked! When I create a new listing, I can’t see any previous dates, and when I submit a listing, the dates are saved (and aren’t reset when I go to the listing page again).

I did notice previously that ActivitySchedule2’s dates were being saved as strange code (e.g. 1508775593775x221516500886618100) instead of dates, so I was confused as to how I could then display these dates, but that seems to have been rectified by using a ‘List of Dates’ instead.

Appreciate your help on this one. Now I need to figure out how to allow a user to ‘select’ the date during booking!

Thanks for your help! I think I’ve set most of this up, the only issue I’m encountering is that all the data inside the ActivitySchedule2 column for previous listings that user has created is deleted on each Page Load. This is how I’ve got everything setup currently:

• Creating CalendarScheduling with Status = Draft

• Make changes to a list of CalendarSchedulings when listing is ‘submitted’. Setting status as Live.

• Deleting list of CalendarSchedulings with the Status = Draft on page load.

Does all of this look correct? I’m still playing around to see if something clicks as I feel I’ve missed something fairly obvious!

In your RG with the dates, the “Select” button can set a Custom State on the pop-up that is a date. You can use this is the display date, and also when you “Book”.

1 Like

Thanks @NigelG - it worked! Had to remind myself about Custom States but I did get it working. :slight_smile:

The last thing I need to do is the following:

Every time I book a class, it should minus 1 from the ‘spaces available’, and when there are 0 spaces available, the date no longer shows.

In my CalendarScheduling data type, I have a number field called ‘Spaces Available’. Therefore each time I add dates, they are given the number from the ‘spaces available’ dropdown when the user creates the listing.

Example here:

I don’t think this will be particularly tricky, so I’ll have a play tomorrow and let you know if I need any assistance (any advice in the meantime would be great).

Thanks again :slight_smile:

This topic was automatically closed after 70 days. New replies are no longer allowed.