Adding a list of temporary links/tags to a state list before adding it to the database

Hello everyone, I’m building an app and need some help in the registration form.

  1. User inputs their Name, Email, Age, Company Name,
  2. Then they have to enter their favourite apps.

Here is a screenshot example I grabbed from Youtube.


Before you submit your video, this form allows you to view the tags a user wants to add to a video.

Since the number of apps can be unlimited, the user types it in the input text box. I want to display the tags in a repeating group, but I’m just not able to figure it out.

I will store all the values in the database once the registration is complete, but before that, I want to manage it at a state level.

Thank you for your help.

Cheers
Imran

It sounds like the apps will already exist in the database, and the user is searching for them in order to list them as favorites, is that correct? In other words, do have App as a database thing, which the users would be selecting from when registering?

If that’s the case, you can create a custom state of type App, and make it a list. As the user adds or removes their App tags, you add/remove from this list. Should be pretty straightforward.

Why are you waiting until the user enters their favorite apps to register them? Seems like you’d risk losing them at that step. Why not register first, then have them list their favorite apps? If they leave at that stage, you can remind them when they come back to the site.

Appreciate your prompt response John.

John - It sounds like the apps will already exist in the database, and the user is searching for them in order to list them as favorites, is that correct? In other words, do have App as a database thing, which the users would be selecting from when registering?
Imran - No sir. The user can type in anything and it won’t search in the database for these tags.

In that case, what are you wanting to store in a custom state? Based on your screenshot, and if the items are just names of apps, seems like it would just be text? If so, you would use the same solution I suggested, just with a list of texts instead.

What exactly are you collecting for these apps, and how do you want to store them? For example, are you just going to store them as a list on the User, or are you going to store each separate entry in a db App table, or something else?

More details around what you’re trying to do and what you’ve already tried that didn’t work would be helpful.

Sure. The user registration scenario, was just an example.

This is the real use case.
I’m building an app for users to keep their videos organized. Every user would use their own words to relate to their videos and search for them later using these tags.

This is what I’ve done uptill now -

  1. I have a custom state setup on the page called ‘Tags’. This is also a list.
  2. In the frontend, the user has an option to enter tags in an input field. Next to the input field is a button to ‘Add’
  3. Below this, I have a repeating group that allows the user to see all the tags that have been added to the custom state ‘Tags’.

Now here is the problem.

  1. I don’t know if the text in the input field are getting added to the list.
  2. Even if they are, they aren’t showing up on the repeating group.

A couple things:

  1. Can you show the workflow that’s run when “Add” button is clicked?
  2. You can check if they’re getting added by running the app in debug mode and inspecting the console element that you have the custom state on. It’ll show you what’s in the state and you’ll be able to see directly if they’ve been added or not.

In general, the debugger is your friend, especially in cases like this. If your texts aren’t getting added, then I would suggest running your workflow in step-by-step mode to see where things are going wrong. It’ll take some time but it’ll be well worth it.

Here you are
Screenshot (14)

I don’t think it’s getting added.

When you’re setting the state, you have the value field blank, so it’s definitely not getting added. You have to tell it what you want the state to be.

What you want to do is reference the current list then add the new item (if you just put the value as the most recent you’ll overwrite). So the value should be something like:

    Included_Tags: add item: Input Tag Text's value

Then it should get added. If you have an “x” by a tag for them to remove, you’d do the same except remove:

Included_Tags: minus item: Parent Tag's value

Something like that.

That’s exactly the problem.
I’m just not able to add item to list.
Screenshot (17)

That option just doesn’t exist for me.

Sorry, it’s plus item, not add item. Always good to scroll down the list and see what your options are.

Oh my god. I’m going to cry. It worked!

Screenshot (19)

This was the final expression that worked.

Thank you so much @johndurso ! I was stuck on this issue for almost 3 days.

Your guidance has really really really helped!

Thank you so much!

1 Like

Happy to help! I’ve certainly been helped by others on here plenty myself.

If you want to mark my reply as a solution that will help others here that may find this post in searching for their own solutions.

Done!

It’s members like yourself that positively contribute to making an ecosystem.
Thank you once again.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.