# How does on submit work

**URL:** https://community.glideapps.com/t/how-does-on-submit-work/66625
**Category:** Ask for Help
**Created:** [September 29, 2023, 12:58pm UTC](https://community.glideapps.com/t/how-does-on-submit-work/66625 "2023-09-29T12:58:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Dan\_San](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dan_san/32/24085_2.png) [@Dan\_San](https://community.glideapps.com/u/Dan_San)
#### Post date: [September 29, 2023, 12:58pm UTC](https://community.glideapps.com/t/how-does-on-submit-work/66625/1 "2023-09-29T12:58:07Z")

</div>

Hi All,  
I have been trying to generate unique ID’s and it has intermittent issues, but I just realised that Glide has implemented an incrementer.

Before I switch it on, I just wanted to understand something.

Currently when I submit (using the submit in the top right) it adds in the column, but if I activate the “On Submit” (which is currently set to none) and select increment number. Is it that there are two actions.

1. Add row like it is doing normally  
and then a second action defined by submit
2. increment the number ?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/9/296d8e9cc1cc599357d9b5d92587e5c6aa8629d0.png)

If instead of selecting “increment number” if I select “add row” will it add 2 rows ?

Just trying to understand how this “on submit” works.

Thanks

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [September 29, 2023, 1:19pm UTC](https://community.glideapps.com/t/how-does-on-submit-work/66625/2 "2023-09-29T13:19:27Z")

</div>

Forms add rows on their own as that is their purpose. So adding an Add Row action On Submit would be redundant if you are adding the same info to the same table.

On Submit is for any actions you want to run AFTER the row is added. So, yes, it is a separate action to the form’s built in add row action.

Just be careful with On Submit. Things run very fast, so there can be times where a row doesn’t fully exist yet when the On Submit actions run, so it may not always work as expected. It all depends on what you are trying to do.

Regarding the increment action, I don’t know if I would use that when adding a row for the above reasons I assume you would always be defaulting it to 1, so I would either add a component that pulls the value of 1 from an existing column, such as a user profile column, or create a hidden number entry component with a default value set to 1. It will save on updates and also be more reliable.

---

<div class="post-metadata">

### Author: ![Dan\_San](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dan_san/32/24085_2.png) [@Dan\_San](https://community.glideapps.com/u/Dan_San)
#### Post date: [September 29, 2023, 1:30pm UTC](https://community.glideapps.com/t/how-does-on-submit-work/66625/3 "2023-09-29T13:30:08Z")

</div>

I am trying to create a unique JOB Number for each job.

I had a fairly simple implementation of maxjob and nextjob=maxjob+1, but if I had two users go in at the same time they would get the same number.

I then gave each user a prefix and the concat it to the nexjob, but it seems to work intermittently, sometimes it works and sometime it doesn’t leaving the jobID blank

---

<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: [September 29, 2023, 1:44pm UTC](https://community.glideapps.com/t/how-does-on-submit-work/66625/4 "2023-09-29T13:44:36Z")

</div>

> [@Dan\_San](#):
>
> I then gave each user a prefix and the concat it to the nexjob, but it seems to work intermittently, sometimes it works and sometime it doesn’t leaving the jobID blank

I remember that. This one, yes? 👇

> [@Field Not Populating](https://community.glideapps.com/t/field-not-populating/65359/6):
>
> Thanks. So I got the affected user to login to a different machine and it seemed to work fine. I then back to the original machine and delete the cookies and cached data. I am monitoring it, I think it is working. I will update you guys later. How to calculate JobID ? I use rollup in Maxjob column to give me the highest job number already used from IDsequence (see below on explanation) I then calculate NextJob = MaxJob + 1 ---- this was then used as jobID at time of creating the jo…

Although I didn’t study your implementation in detail, the general approach seemed quite sound to me, and I would have thought it should work.

How were you setting the JobID?

If you were doing it as an onSubmit action, then I’m not surprised it didn’t work reliably.  
But if you were to pass it with the form as a User Profile value, then I’d expect it to be a pretty solid solution.
