Forum Academy Marketplace Showcase Pricing Features

I need help saving a user's weekly availability for calendar purposes

Hello Bubblers,

If someone could be so kind, I am trying to save a user’s availability to a database. I want them to be able to pick and choose their availability as opposed to saving each day to the database along with the time. Currently, I have each day as a field under the user datatype in my DB. and when the user enters their time for each day, the time is save under the field for each corresponding day.

like so:

31%20AM

But I want the user to be able to click on each day that they are available and then select the times. I need to be able to refer to the user’s next available day, next available times, block off times, etc. I don’t think that the way that I’m saving to the DB will allow that. An example of what I’m looking for is in the screen shot below.

Can someone please help and point me in the right direction? I don’t know anything about raw coding.

Hey @gaffneyantonio did you get a way around this ?

Is this close to what you need?

  • Your User table would need something like the datatypes (of type date) MondayFrom, MondayTo, TuesdayFrom, TuesdayTo, etc. You’ll also need yes/no fields MondayAvail, TuesdayAvail, etc.

  • Have a set of custom states on the page: enableMonday, enableTuesday, etc., all of type yes/no.

  • You can build an object like the bottom example you have. If the user checks (for example) the checkbox next to Friday, you would set the User’s FridayAvail to “yes” and set the state enableFriday to “yes”. If they uncheck it, set the User’s FridayAvail to “yes” and the page’s state enableFriday to “no”.

  • add code to enable or disable each day’s set of times based on the value of the corresponding custom state. For example, if enableFriday = “no”, disable to times group; if “yes”, enable the times group.

THIS ALONE will get you a page that will let the user enter in times only if they check the available checkbox.

I suggest doing the above, but just concentrate on doing it for one day, like Monday. If you can successfully get that far, we can move on to how to handle the times, which I can also help with.

FYI: I’ve more or less done something similar to this myself, and it works pretty well.

Hope this helps.

Also FYI: what you want to do is an absolute pain in the butt to code, but it’s pretty easy if you do it in chunks.

Me again.

Sorry, I should have given you an idea of what I’m aiming for.

Your page will let each user indicate if they are available for a particular day.

If they ARE available for a particular day, the page will let them enter in a time range to define when they are available that day.

Ultimately, if you need to see if they are available on any given date, you can determine what day of the week that date is and use that to see if the user is available on those days or not. If so, you will also be able to determine what times they are available.