Dynamic list behavior in input form

I want to dynamically add items to a frontend form from a backend table. I have the connection to the database working and the values rendering on the form as Checkbox labels, and I put an input box on the forum just to see what happens. The inputs do not show up in the form data on submit.

I tried it with a text input as well and as soon as I put the input into the dynamic list behavior block it stops showing up in the form data.

https://magicaljelly.backendless.app/api/files/ui-builder/containers/default/index.html?page=share

form-data

Is this something UI-Builder doesn’t support or am I doing something wrong?

Thanks,
Tim

Hello @Tim_Jones

As I see, you bind values from the inputs to Seller Share Seller Block, and that’s why you get an empty object when trying to show an alert with AddSellerFundraiserForm data.

Regards, Dima

Hi @Dima_Vak,

I am binding the inputs as I need the values to come from the table object I load on page enter.

I’m trying to build a dynamic form so the values have to be bound to the Dynamic Link Block.

Is this something that UI Builder doesn’t support?

Tim

Another related question. I on my form I have an input FirstName that is bound to AddSellerFundraiserForm. If there is a value in the input, it will show up in the alert from the AddSellerFundraiserForm Data. But if the value is blank, nothing shows up.

Why doesn’t AddSellerFundraiserForm Data have FirstName: ‘’ or something to show that the value is blank? How do you edit something and remove a value if the lack of a value isn’t returned?

Tim

I worked around the data binding issue by adding the property to the form data on mount

This seems like a lot of work for something that feels like it should happen automatically as the elements are inside the form. What is the purpose of the form element if you have to manually bind the inputs? It also seems like a problem that the default value binding and the submit value binding are in conflict with each other.

Tim

I am binding the inputs as I need the values to come from the table object I load on page enter.
I’m trying to build a dynamic form so the values have to be bound to the Dynamic Link Block.

Logic at your screenshot looks right. And as I see in your app now, you get success with dynamic rendering.

Another related question … Why doesn’t AddSellerFundraiserForm Data have FirstName: ‘’ or something to show that the value is blank? How do you edit something and remove a value if the lack of a value isn’t returned?

As I say earlier, your input have incorrect binding(to Dynamic Block, not to Form)

This seems like a lot of work for something that feels like it should happen automatically as the elements are inside the form. What is the purpose of the form element if you have to manually bind the inputs?

First of all, it is a semantically correct way to build your app. Also, this component creates an storage - Form Data Model and some events like Submit and Reset.

You could bind value to Form Data Model in the same way as to Page Data Model. With or without creating handler. But pay attention to a hind under handler. I think some misunderstandings comes from there.

image

image

It also seems like a problem that the default value binding and the submit value binding are in conflict with each other.

Could you tell me what is submit value binding?

Regards, Dima.

Thanks @Dima_Vak

I’ve updated the page to make the question a little clearer -

https://magicaljelly.backendless.app/api/files/ui-builder/containers/default/index.html?page=share

If you submit the form without touching the email input it doesn’t show up in the form data -

If you put a value in, it does, so it is bound correctly I think

binding

Why would it not show as blank in the first example?

Could you tell me what is submit value binding?

EDIT: Better explanation. In traditional HTML inputs inside the form tag are bound to the form object. That binding doesn’t stop you from binding the value to another object. The inputs have a name and a value for a form input, like this:

$dbObject
<form>
<input type="text" name="Email" value="$dbObject[‘Email’]" >
</form>

On form submit “name”, in this case Email will show up in the submit object as a key, so I’m calling that the submit binding. There is also “value” which lets you set the value from a DB or whatever. So you can bind the incoming data and the outgoing submit data. The input field in UI-builder doesn’t have a name field so it seems like you can only bind to one or the other. Is that not right?

Tim

Because empty value(empty string) is still value, and while you do not trigger binding by touching input, value does not come to Data Model. By default data model is an empty object.

So you can bind the incoming data and the outgoing submit data.

If you bind your input to a Page Data property for example. And fill this property from your DB, input will react on it, and change the shown value. When you touch input and change value, that would change bound Page Data property.

That names two-way data binding. Here is a little example, where you could bind data from input to storage, and from storage to input(by clicking a button) - link

There is also “value” which lets you set the value from a DB or whatever…
…The input field in UI-builder doesn’t have a name field

This is not a native feature, and I can’t be sure, but this might be two-directional binding(and we provide it). Or initial value for component - we also give this possibility.

Regards, Dima

Hi @Dima_Vak,

I don’t 100% follow what you’re saying but it sounds like it is possible to do what I want.

Thanks for the help so far!

Tim

2 Likes