Hi all,
I am looking at a way to use the form element so when the user taps on submit (or a button component built into the form) it then submit’s the form but retains some current values for them to upload another.
The example is this:
User takes a photo of a receipt, fills in some details like date, cost code, material, quantity ect
User taps “submit and add another” then I submit that row and clear some of the values in that form after submission like “materials” and “quantity” ect but keep “photo”, “client”, “cost code” ect.
I’ve been playing around with custom actions but I can’t seem to do it with “set value”. Any ideas?
I’m sure there are a few ways you could do this. Which you choose may depend on things like if care if those retained values appear the next time they open the form, no matter if they do it then or later.
Option 1: on submit, save the values you want to retain somewhere, and use those as defaults in the form. These could be saved in the users table, or some single row table with the columns being marked user specific. You could further add some expiration to these values by having them saved as described, but rather than have those fields be the form default values, have ITE columns be the default values. And the ITE columns would be conditional on when those retained values were saved (eg in the last 24 hours.) This option requires an on submit action to write these values to wherever you’re retaining them (which costs an update.)
Option 2: Similarly have the form defaults be your retained values, but this time rather than saving them, you could just look them up. Use some query/relation/single value of sorts to have the default value be whatever value it was on the last submission. Benefit of this is it wouldn’t cost an additional update with each form submission.
I am not sure I fully understand your use case but have you considered or tried using the edit screen form after the initial submission is done by the user.
You will have built your custom form components for the initial submission but now you will need to build an edit screen by adding the components that the user will edit or add information on using visibility conditions so that the information that was submitted earlier is not visible when he opens the edit screen.
I have not gone through the whole user flow because I am not sure if you had tried this or not and therefore I will wait to hear if you have tried it but that how I would work around it.
Unless I’m misunderstanding… this wouldn’t work. An edit form opened on the data of a row just submitted, would be editing that data the user just submitted. But here Chris wants prefilled data in a form to create a new row, and he wouldn’t want to edit the recently submitted data.
In the case of wanting a new row, how about “on submit action” where you can then add a new row when you submit the edited information?
Would that not work? I have not tested what I am suggesting and for me I always find Glide difficult when I have to discuss it theoretically. I believe in trial and error and every now and then you stumble on a trick and you don’t even know how you got it right but somehow it works …
Edit:
Never mind this, I have read the story again and it seems like I misunderstood what he wants to achieve…My bad…
Luther I’m always impressed with the experts here on how easily they’re able to just know and describe each needed step. I know what you mean about often needing to poke around and see what works. I’ve found over the last few weeks by coming here to the forum and trying to answer people’s questions, I’ve gotten better at really understanding how different things work and being able to think them through and explain them, rather than just trial and error it in the builder.
I originally built my apps with custom forms… then Glide switched to charging for updates and now I avoid them. I think many app owners may not care but in some cases it makes a huge difference. Standard form will be one update. Setting values to retain the autofill values would be one more (or none to look them up.) But custom form will mean one update per field entry (or more for a long text entry and the user is pausing for a few seconds between thoughts.) Custom forms do offer the benefit of saving values before submitting though… especially on a long form, users could get really upset if they accidentally close the form. Anyway, just something to consider when deciding which way to go.
Yeah, I agree. I don’t think I ever face any updates problem since they introduced that into the pricing system, but maybe my clients are all on a super early stage of testing.