I am wanting to create a “custom” form with a series of choice components and a button linked to a custom action with an add row action, and I’m struggling to get my choice components working.
Here is what I have:
- A sheet with a list of choices
- Another sheet where my “form” responses are to be collected
In the Glide data editor, I’ve created a bunch of user specific columns in the response sheet to temorarily store the data collected via my quasi-form, before it’s commited with the add row action.
I started by adding a button to my home screen, with a link-to-screen action to my response sheet.
On the next screen, I’m using a details layout with all default components removed, and have added a series of choice components to collect the form data I need. Each of the choice components uses the choices sheet as its data source, and writes to one of the user specific columns that I created in the response sheet.
My next intention will be to add a “Submit” button with a custom action that will perform an add row (along with a few other actions).
But my problem is that by default, all of the choice components are disabled and empty.
I have found that if I add a single row of dummy data to the response sheet, then the choice components will pick this up and use it as a default (with all other choices shown). But this is clearly not right.
I feel like I’m going about this the wrong way.
So your problem is only related to the “default” for the choice components? You don’t want them to submit empty entries, or do you want them to have default values assigned?
I want them to be required fields, but I don’t want them to have any default values.
So in your “Submit” action, have a branch that says “if A is empty or B is empty or C is empty etc” then show failed notification: “Please fill out all required fields above”.
Else add row & show successful notification: “Submission recorded!”
Yes, I get that.
But the problem I have is that if that first row of dummy data isn’t present in my response sheet, then the choice components are unusable - they become disabled and the user cannot tap/click them.
You can just store them in user-specific columns anywhere in your sheet I suppose.
I think this part isn’t needed, the link-to-screen action can just link to the same row that you use for your “home” tab. Then catch the user’s email alongside your add row.
So @ThinhDinh - is this normal and expected behaviour? It just doesn’t seem right…
Yes, as you said above, there’s no row so you can’t use “that row” because it hasn’t existed yet.
Is there any reasons you don’t want to use user-specific columns in your Home sheet before an “add row” action?
I don’t really want to “pollute” my home sheet with these. I suppose I could just create a Glide table and use that for this purpose?
Although I guess I would then need a relation between that and the response sheet, otherwise I wouldn’t be able to add the row - does that make sense?
You don’t need a relation to add the row. You can do it from anywhere you want, just make sure you have an existing row to show the screen and write the temporary values to before adding.
Okay, got it. Making progress now. Thanks @ThinhDinh