Erase a form after submitting it

I have a form in my app Buk, where people fills text entries, and then press a button to add a line in the sheet. I’d like to erase the text entry fields in the app after they are added to the sheet.

How can i do that?

Thanks,

Jonatan

You can create a custom action that first adds the row and then clears the column values afterwards.

Also, just checking, but are you aware of Glide’s native form function that would prevent you having to clear the column values?

2 Likes

Adding to what Jeff said, I believe you’re using a “custom form” where you have entry components on the screen and finish it by an “add row” action?

You can either use the action “Show form” and build your entries there, or use a set column action within your current flow to add a new row, clearing all entry columns after adding a new row.

1 Like

Can i make a tab a form? because i only found the form button, but that would add another step (touch to get in the tab, and then touch the button to open the form)

With the other way, with a custom action, what is the action i should use to clear the text entries and notes fields in the app (but keeping the data in the row added)??

Thank you very much!

That is the tab with the form. 2 Text entry fields and 1 notes fields. Then the button that should add the row and then clear the text used as input.

Thank you all!

Use a custom action in the button.

  1. Add row to destination sheet
  2. Set column > clear values of the current sheet
1 Like

i didn’t find “clear values of the current sheet”.

That won’t erase the row that i’ve just added with the form?

It’s Set Columns > this row > (whatever columns you want to clear) > Clear value

2 Likes

Also, make sure all those entries are written into user-specific columns so users won’t overwrite each other.

2 Likes

Ya … I thought to mention this…didn’t want to overwhelm :?

1 Like

I also did all of that, but still doesn’t work… Can anyone help me in this? Maybe here are some software developers in this site here?

Some great suggestions above. Just in case it helps, I’m happy to share my tip for working with forms.

  1. Always create a Glide Table called FORM in your app
  2. The FORM table should have 1 row only. The first column should be a simple TEXT column. Call it something random like Index and insert 1 as in the value in the first cell
  3. All other columns will have values that will be useful to your forms and be specific to each user. Hence, if your form has 3 fields, e.g. Comment A, Comment B, Comment C then create 3 Text columns and make sure each one is User Specific
  4. To add a form feature in your App, add a button and edit the button & design, here we see screen with a button that will add a new theme:

image

  1. Change the action that is triggered by the button. It’s good practice to create a custom action like this one. Notice how the new action is Show New Screen with the data coming from the FORM table.

image

  1. If you click on the button it will open the new screen ready for editing. Now you can switch to ‘Details’ style and add some form input components.
    image

  2. The secret here is that all users edit the first row of the FORM table. But since the important cells are all user specific nothing gets muddled. In the example below I have added a Text input component and then a button bar.

image

  1. The text input writes to a field in the FORM sheet. I play with the visibility of the button bar (actually I have some duplicates with different conditions) so that when the input field is acceptable the buttons are visible/active. Clicking Back has the Go Back action.

  2. Clicking Submit has a Custom Action, which will add a row to your data table. In the my example, there are 3 steps: Add a row; Show a notification; Clear the form

image

You can see the detail for the Add Row step below. Notice how it adds a row to a Themes sheet then sets some columns, e.g. the Text field from the previous screen and then I automatically force in a category descriptor (S) into the category cell. You could automatically add other data like Date/time, user email, etc…

I find this a safe way to work with forms. Good luck!

5 Likes

I’m crafting a video and demo app now for you.

Create a copy here: https://formtypes.glideapp.io/

5 Likes

Thank you @Robert_Petitto ! I’ve tried your solution but i cant make the columns user specific

image

Why is that?

That seems to be a column that already exists in Google Sheets/Glide Tables. You can only specify new columns as user-specific.

Right. @jonyko Just PMed you…

If you add a RowID column, this step isn’t necessary. Glide will create the first row for you.

4 Likes

Hey Robert! I made this loom explaining my question. Let me know what you think! Thank you so much
loom video

What you have there is a bit unconventional, and I’m afraid it could cause you issues down the road…especially if you plan to edit those entries once they’ve been added, which could very likely use the same edit form that you are already using.

The main issue is that you are using an Edit form, which happens to be set to edit the first row in the table. You are actually filling that first existing row, then moving all of those values to a new row, and then clearing it out. A much much easier method would be to simply use a normal Add form if your screen was configured as a list style view. However, you are currently using a Details style view which is fine and offers some benefits. Just keep in mind that a screen with a details style layout is always connected to an existing row, unless you set some crazy filters or don’t actually have any rows of data…but normally it’s connected to the first row that’s in a table or the first row that matches a filter, unless you get to that detail screen from a higher level list. If you want to stick with a details style view, then I would recommend using a form button instead and turn off the edit button. I don’t see reason why you need to reserve a blank row just for adding new rows when there is already a native Add form or Form button which will function the same and be much easier to manage without the need for additional On Submit actions or a reserved empty row.

Also, with the way you are trying to trick the Edit form to function as an Add form, you will have problems when you later want to edit your existing entries and it starts using that same edit form. You may end up inadvertently duplicating an entry and clear the existing entry which will just create a bunch of blank rows in the end. It will just make a mess of your table. An Edit form should be reserved for editing existing rows of data. Not for creating new rows of data, unless you have some sort of special use case, which I don’t see here.

I will still address some of your questions though.

  • Regarding sorting, when you select the inline list, there will be an Options tab on the right side of the builder. In there is where you can set your sorting to sort by date.
  • The reason for the glitching in the list is because you are populating that first row, then clearing it and adding a new row. You see this all happening in the list.
  • If you change your flow to stop using the Edit form to function as an Add form, then you won’t have to worry about blank entries in your list, but in that same spot where you can change your sorting for you inline list, you also have the option to set a filter, so you could filter out rows that you don’t want to see, but again, if done correctly, you shouldn’t have empty rows.
4 Likes