How do I turn a unique ID that has been grabbed as text from a bubble page URL, and turn it into a Thing format so I can populate it into the database?
Here’s the background:
As a business we give out samples of our products to our customers, and then ask them for feedback on those samples.
My app is being built to record what samples were given to which people. And then to record their feedback.
After they are given a sample, I email them a link to a Bubble feedback form (https://primedental.bubbleapps.io/version-test/frm_sample_feedback/1516475123842x262819764138147840. The form is a bit of a mess because i’ve been trying different controls to get it to do what I want).
The last part of the link contains the unique id of the ‘Sample Given thing’.
This I’ve managed to setup no problem.
I’ve also been able to get a “single line Input form” field to extract the unique id from the URL and display it.
However, the format of this “single line input form” is text, and so I cannot submit it into the unique ID field of the ‘Sample Feedback thing’ when my customers submit their responses in the feedback form.
Just curious… are the customers users of the app? i.e. Do they have a password they use to log in with? Or is this all email based.
At this stage I haven’t decided on that. I could probably go either route. Which route would make it easier to get the functionality set up?
It’d be much easier to treat them as users in the database. It will also make things more scalable for down the road…
By the way I just noticed something on your form; the single line input form field is displayed as a placeholder. On the back-end, you would need to take the line of “code” that is currently in the placeholder text field and plug it into the “initial content” field below it to be able to make use of it in the database. Then in your workflow, when button “save” is pressed, you can map the now dynamic input field’s content (unique id) where you want it to go in the database.
I’m not sure I’ve fully grasped the overall problem you outlined yet, but I will try and respond anyway based on what I think your goals are. Please correct me anywhere I’m off topic. Without seeing how your database is set up, I think there might be an easier way to achieve what you want. Track the user not the form.
1) Database: Build the database with only one data type, (in addition to the pre-existing “user” type) called something like “Form Response.” Then add all of the form’s questions as data fields in the right column. Add an extra field named “Email.” Make it required by ticking the “should not be blank” checkbox when creating an input for it.
2) Database: Add a field under Form Response named “User id” and make its field type = “User”
3) Database: Add a field under User named “Form id” and make the field type = “Form Response,” and check the “this field is a list” box.
4) Workflow: Step 1: Create New > Response Form > User id = input field “email.” Step 2: Make changes to list of things based on Step 1, > (list of) Users > [do a search for User > email = input email’s value] > change/add this form’s unique id to list of “Form id’s”.
This will let you search and display or report your data more easily. ex: "do a search for > Form Responses > User id = [email]. --> All forms that user has ever filled out. The reverse also works.
There are certainly more than one way to skin a cat, this is just one. Hope it helps.
If you have mailed a unique link to someone, it will create extra friction in the process to have made them signup to create a user so that you can then send them a link.
The way I do something very similar is to pass a unique reference in the URL that I send to the email address (who are not users as it makes it more complex).
Store the reference when you send the email, so you know who it is for.
Or something similar - you can use the unique id, or you can create a random string.
Then on the page, read in the URL parameter and then you can search for the details.
thanks so much for the input @willtaylordesign and @NigelG.
You’ve both given me cool approaches to try out.
I’ll give your ideas some deeper thought tonight and let you know how I go.
I actually really like @NigelG’s method. With mine, while the link wouldn’t have to be unique and saving user data this way would be more scalable, but on the downside the user would have to answer a “what’s your email” question (no password). Nigel’s approach doesn’t require that question since the link is unique per individual. The only thing I would consider adding to get the best of both worlds would be storing the form’s reference id and recipient’s email address together under the User data type. If you make their password = their email address, they’ll never have to sign in. Just keep a hidden field on the form with their email address in it (you’ll know because of the reference id) and set it as both the email and the password’s value.
Hi @NigelG and @willtaylordesign,
Thanks so much for your input.
I went with @NigelG’s idea and it worked like a charm.
The trick was to change my mindset of trying to search the “unique id” field of the Sample Feedback table. I built into my workflow to copy the record’s unique id to a text field of a similar name. I found that Bubble was very happy to search the text field for the text string I’d extracted from the URL (whereas it wasn’t happy to search the “unique id” field for the text string, due to data type incompabilities - unique id is not seen as a text data type).
One thing to note for other newbie Bubblers: I could not find the “Get data from URL” within the “Insert Dynamic Data” menu. However, if you just start typing "Get … " it brings up the “Get data from URL” option.
Many thanks again for your cool advice guys.
I’ve been trying to accomplish something very similar to what @aa3785 has done, but I can’t seem to replicate his success.
What I’m struggling with is reading the the unique string that is contained in the URL, and using that string to dynamically add text to a page.
In my example, I want my users to be able to send surveys out to many people. Each user will have their own unique survey link, which will be created using their User ID. An example would be:
When the recipient of the survey clicks on the link and lands on the survey page, I’m hoping to use the User ID contained in the URL to fill in who the survey is for. It will read something like:
“Survey For: Ted Barbeau”
Any help would be greatly appreciated as this has been a sticking point for me.
In your case the uid is part of the path rather than a parameter.
So you still use “Get data from URL” but drop down the Type to choose Path instead of Parameter.
This assumes you have a page called “form”.
If page “form” is of type User, this page’s thing will be the User represented by unique ID 1547580194155x116136670333941490. Problem solved.
Lesson: Do things the Bubble way. Do not do things the non-Bubble way.
(Aside: If 1547580194155x116136670333941490 is not the uid of a User, this page’s User will be null. And so, you should bounce the Current User to some other page, as they are clearly trying to hack your app.)