# Form Submit hours of operation

**URL:** <https://community.glideapps.com/t/form-submit-hours-of-operation/52822>\
**Category:** Ask for Help\
**Created:** [October 29, 2022, 2:39am UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822 "2022-10-29T02:39:42Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_Knight](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sean_knight/32/8722_2.png) [@Sean\_Knight](https://community.glideapps.com/u/Sean_Knight)\
**Post date:** [October 29, 2022, 2:39am UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/1 "2022-10-29T02:39:42Z")

</div>

I am creating a form submit and i want my staff to submit hours of operation in a business directory.  
Any ideas to have a clean design with each day of the week and a drop down for each hour of the day, and an option for Closed.?  
please any help really struggling with this.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [October 29, 2022, 3:50am UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/2 "2022-10-29T03:50:30Z")

</div>

1. Multiple businesses submitting their hours in the same app?
2. Users being able to see which businesses are open/close on any given day?

---

<div class="post-metadata">

**Author:** ![Sean\_Knight](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sean_knight/32/8722_2.png) [@Sean\_Knight](https://community.glideapps.com/u/Sean_Knight)\
**Post date:** [October 29, 2022, 6:16pm UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/3 "2022-10-29T18:16:41Z")

</div>

Robert, that would be the idea when we have enterprise tier with glide but right now its just our staff imputing the hours.

Correct, users being able to see which businesses are open/close on a given day.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [October 29, 2022, 7:20pm UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/4 "2022-10-29T19:20:21Z")

</div>

@Darren_Murphy you want to take this one? 😅

@Sean_Knight , Darren and I were having this exact conversation several weeks ago and he created something rather elegant, but fairly complicated to get this to work efficiently.

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [October 29, 2022, 7:20pm UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/5 "2022-10-29T19:20:28Z")

</div>

something like that?

> **[Business hours & QR DEMO](https://business-hours-demo.glideapp.io/dl/74c4fe/s/0f5325)**
>
> adjust business operating hours, blockout dates, check if business is open now, QR vCard for easy adding to contacts.

[![Bussines hours DEMO](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/a/caab83fbc4cc65410a9795529e722f956cbf117e.jpeg)](https://business-hours-demo.glideapp.io/dl/74c4fe/s/0f5325)

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [October 29, 2022, 8:54pm UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/6 "2022-10-29T20:54:38Z")

</div>

@Uzo this example is a good option for those that have one establishment.

What would you build for apps that have multiple businesses with varying hours? I guess a transposition of an open close times per day (14 columns) into a working table?

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [October 29, 2022, 9:40pm UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/7 "2022-10-29T21:40:58Z")

</div>

Hmmm… i can think of some universal algorithm, to take care of unlimited entry

---

<div class="post-metadata">

**Author:** ![Sean\_Knight](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sean_knight/32/8722_2.png) [@Sean\_Knight](https://community.glideapps.com/u/Sean_Knight)\
**Post date:** [October 30, 2022, 1:58am UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/8 "2022-10-30T01:58:44Z")

</div>

for us, its for a chamber of commerce glide page crm where staff manages the data of the member business and one of the data sets is hours of operation.  
So indeed multiple business-

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [October 30, 2022, 2:09am UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/9 "2022-10-30T02:09:23Z")

</div>

As Bob mentioned earlier, I have something that you might be able to use. It’s a little complicated, so not easy to explain. I’ll make a video later today and share.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [October 30, 2022, 9:51am UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/10 "2022-10-30T09:51:44Z")

</div>

@Sean_Knight - this may or may not be useful for you, but it is what @Robert_Petitto referred to in his earlier reply.

Typically, for this sort of thing there are two approaches you can take.

The first approach involves creating a series of columns in your Businesses table. Essentially a pair of Open/Close time columns for each day of the week. This approach is okay, but can become a bit fiddly if you ever want to present them as a list. It’s the approach that Bob alluded to here…

> [@Robert\_Petitto](#):
>
> What would you build for apps that have multiple businesses with varying hours? I guess a transposition of an open close times per day (14 columns) into a working table?

The second approach would involve creating a second table, and using one row per day per business, and then relating that back to your Businesses table. This approach is much cleaner, but can eat up your row count very quickly.

What I am sharing below introduces a third approach, where you store the open/close times for each business in a single column in the Businesses table as a JSON object, and use a helper table to manipulate the object. This is a technique that I’ve been developing over the past few months and have used in a handful of projects.

Here is a video that gives a walk through of how it works:

And here is a copyable template:

> **[Business Hours Concept](https://go.glideapps.com/template/Boen5KvzJeVxRKyizmmj-template-published?privateTemplateToken=EALR9nrGHI3ch39zMPKN)**

@Robert_Petitto - I’m not sure if you ended up using this idea in your project, but just in case - there are a couple of things I’ve changed in this template version:

- I’ve abandoned the JQ plugin in favour of pure JavaScript. I did this because in one of my other projects I found that the JQ plugin doesn’t scale well.
- I fixed the bug where the hour of the day comparison sometimes doesn’t work (for partial hours)
- I found and fixed another bug where editing hours sometimes didn’t save correctly. This bug was a side effect of the fact that you can’t reset multiple rows with a single action. Fixed this with a variant of @Jeff_Hager’s parent\_id approach.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [October 30, 2022, 6:21pm UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/11 "2022-10-30T18:21:50Z")

</div>

Bookmarking this for later 😅

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [October 30, 2022, 9:14pm UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/12 "2022-10-30T21:14:55Z")

</div>

> [@Darren\_Murphy](#):
>
> you store the open/close times for each business in a single column in the Businesses table as a JSON object, and use a helper table to manipulate the object

> [@Darren\_Murphy](#):
>
> a variant of Jeff’s parent\_id approach.

👆 What??!

I’m curious and slightly anxious to see what Darren will be explaining in the video. I’m bookmarking this too.

---

<div class="post-metadata">

**Author:** ![kabookie](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kabookie/32/10994_2.png) [@kabookie](https://community.glideapps.com/u/kabookie)\
**Post date:** [October 31, 2022, 12:13am UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/13 "2022-10-31T00:13:45Z")

</div>

@Darren_Murphy this is so helpful. I have open/close hours for restaurants in my local directory app and was contemplating adding this feature but had not yet tackled the logic. I will definitely add this method to an update. Thanks!

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [October 31, 2022, 2:36am UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/14 "2022-10-31T02:36:19Z")

</div>

> [@nathanaelb](#):
>
> > [@Darren\_Murphy](#):
> >
> > a variant of Jeff’s parent\_id approach.
> 
> 👆 What??!
> 
> I’m curious and slightly anxious to see what Darren will be explaining in the video. I’m bookmarking this too.

Actually, I skipped over that part in the video. In hindsight, I probably should have explained it but I was worried about the video being too long 🤪

It’s the business/parent-set User Specific Column in the Business Hours Helper table.  
The form that is used for editing the hours for each business is a custom form, with each of the Open/Close times being written to User Specific columns. There is some if-then-else logic that determines what should be written to each of these columns as the form is opened, and they are cleared when the form is saved. The “bug” was that it is possible for a user to dismiss the form without saving, in which case the User Specific column values for that row are not cleared. This can mess up the if-then-else logic because those values will still be there when you view the next business, and so it can appear as though that businesses hours are messed up. The parent-set value addresses this. When the form is opened, that column is set to the business ID, and then that’s included in the if-then-else logic, ie. only consider the User Specific Values valid if the parent-id matches the current business ID.

Clear as mud? 😆

---

<div class="post-metadata">

**Author:** ![Sean\_Knight](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sean_knight/32/8722_2.png) [@Sean\_Knight](https://community.glideapps.com/u/Sean_Knight)\
**Post date:** [October 31, 2022, 2:46am UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/15 "2022-10-31T02:46:47Z")

</div>

Thanks @Darren_Murphy Darren! not able to clone , I have three bouncing bars … strange. Any Thoughts?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [October 31, 2022, 2:58am UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/16 "2022-10-31T02:58:04Z")

</div>

hmm, I wonder if this might be an issue with Private Templates. When they are published, the link includes a token, and I’m guessing that might expire.

I just published it again and generated a new link. Try the following:

> **[Business Hours Concept](https://go.glideapps.com/template/Boen5KvzJeVxRKyizmmj-template-published?privateTemplateToken=EALR9nrGHI3ch39zMPKN)**

After you click “Copy in Glide”, you should see the following:

![Screen Shot 2022-10-31 at 10.54.59 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/f/6f32d28169579441092d8f1e8716aacb598e3018.png)

At that point you can choose which team you want it in, and then click on copy and it _should_ work.

---

<div class="post-metadata">

**Author:** ![Sean\_Knight](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sean_knight/32/8722_2.png) [@Sean\_Knight](https://community.glideapps.com/u/Sean_Knight)\
**Post date:** [November 5, 2022, 7:51pm UTC](https://community.glideapps.com/t/form-submit-hours-of-operation/52822/17 "2022-11-05T19:51:58Z")

</div>

thanks Darren, Jumping back into this , i also invited Cecil @ [isightllc@gmail.com](mailto:isightllc@gmail.com) thnx again  
Sean
