Can we save multi value data in Custom States

I am working on form In that I want to save data of user type(Name and Mobile Number) in custom state and want to display in repeating group. Is it possible?

More Examination:
I have Data Type: “User”
Two Fields In It
First - “Field Name: Name, Field Type: Text”
Second - “Mobile Number: Number”

I have created one page: “Testing” and Added custom state Name: “TempUser” and State Type: “User” and clicked on List.

On Testing page I took two input box first for “Name” and Second for “Mobile Number” and a button for saving this inputs data in custom state and want to show same in below repeating group “RepeatingGroup User” which holds Two Text fields for dynamic values “Name” and “Mobile Number”

I request all of you kindly help me…

I’m not sure what your question is?.. What exactly are you having trouble with?

I want to save two field of user type in custom state and want display in repeating group.

You just need to save the ‘User’ in the custom state (not specific fields - you can access those by referring to the user).

Then use that custom state list as the datasource for your repeating group.

I can’t really see from your screenshot (it’s a bit too small to make out), but it looks like in the text box inside the RG cell you’re referring directly to the custom state list.

If you do that, you’ll get the full list, repeated inside every cell (which is almost certainly not what you want) - so in the text boxes inside the RG cell you just want to refer to that cell’s data (not the full list).

In terms of adding User’s to the list, as you’re using text inputs, you’ll need to search the database for users who’s name or mobile number matches the input values. That search will return a list, so you’ll then need to select the first item from that list in order to add it to the User list state. So something like:

testing's TempUsers: plus item: search for users (name = name input's value) (mobile = mobile input's value): first item

Bear in mind, as you’re using text inputs you’ll need to make sure your values match exactly (including capitalization) in order for the search to return a User.

You might want to consider using a search box instead of a text input, to ensure you always match an actual user - then you can just add the search boxes value to the existing User state list.

2 Likes

I am adding new user to system but before it save in database I want it to store in custom states as I have few more inputs required from user but to improve performance I want to save new user’s Name and Mobile Number in custom states and then in last after taking all information I’ll save everything at once using create new thing. I know I am not able explain my exact issue I am new to bubble.io I am also confused sometimes. My apologies for that. But can I add new users fileds in custom states and then after all the information collected I’ll save in one single work flow?

Ok, if the User doesn’t exist yet, then you can’t store them on a User type field (obviously).

So in that case just use ‘text’ custom states (you don’t need a list state if you’re only storing a single item).

Have a text custom state for ‘name’, and another text custom state for ‘mobile number’ which can be set directly from the inputs.

Then when you’re ready to create the new user, apply the custom state values to the relevant field on the User data entry.

If you’re trying to create a list of (temporary)users before signing them up, that will be a little more complicated (and problematic). If that’s what you’re trying to do here, personally I’d suggest rethinking that approach, and just creating the Users right away then modifying them (or even creating a temporary datatype to store information until you’re ready to sign them up).

But if you want to use custom states for that, you’ll need to create 2 text custom state lists (1 for name and 1 for mobile).

Your content type on your RG will need to be ‘text’ and the data source can be one of the 2 lists (e.g. the list of names).

Inside the RG cell, in a text box you can display the current cell’s text to show the name, and in the other text box (for mobile number) you can display the mobile list states: item number: current cell’s index (to match the item number from the mobile list to the item number of the name list).

The main issue with this is that you can’t have duplicate items on a list state - so if you have 2 people called John (for example) it wont work.

So, personally I’d take a different approach and create database entries right away (even if they’re just temporary).

I’d create a new thing when you add their name and mobile number, and then use a custom state list to store that ‘thing’

Have the RG content type set to that thing, and the datasource set to the custom state list (to make sure you’re only showing the newly created things, and not all of them).

Then, when you’re eventually ready to turn them into User’s (once you’ve added their email addresses if that’s what you’re doing), I’d schedule a backend workflow on the custom state list, and use the ‘create account for someone else’ action to sign them up etc. Then delete the temporary user data if necessary.

1 Like

I think I have understood what you are saying. Let me implement it practically. I’ll let you know this works for me or not.

1 Like

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