Problem assigning source records to Forms

Problem assigning source records to Forms

  

Hi everyone,

So this is something that has been bugging me for quite some time now. I know the workaround but I would love to know why I need to apply this workaround.

So this is the scenario:


The preparation of the webblock:



Isn't the whole point of the source record to "fill" the form? 


PS: This is happening in the preparation but this also happens when I want to refresh the form widget, in other words it does not get updated even if I update the source record - so I am forced to do the assign.


Is this a bug?


Thanks in advance.


Regards,

Ricardo

hi Ricardo:

Hi Gede, I am filtering by CarrierId :)

Ricardo, 

You shouldn't have to do a workaround.

The Source Record on Form should be GetCarrier.List.Current and this should be enough to retrieve the carrier, but without knowing the struct of your entities, I may be sending guessing. 

The assign isn't needed with that mention above.

Also, the carriers is a list of Carrier? 


Abílio Matos

Hi,

If you use that webblock to show only when user does something, it's by design

Especially with forms, it's a bit annoying but it's by design for now.

Outsystems will create the form only once with the first data. if you don't explicitly assign new data, it will keep the old data.



J. wrote:

Hi,

If you use that webblock to show only when user does something, it's by design

Especially with forms, it's a bit annoying but it's by design for now.

Outsystems will create the form only once with the first data. if you don't explicitly assign new data, it will keep the old data.



But it doesn't even load the first time the webblock is rendered. That's what's also confusing me :/


Abilio Matos wrote:

Ricardo, 

You shouldn't have to do a workaround.

The Source Record on Form should be GetCarrier.List.Current and this should be enough to retrieve the carrier, but without knowing the struct of your entities, I may be sending guessing. 

The assign isn't needed with that mention above.

Also, the carriers is a list of Carrier? 


Abílio Matos

Even with GetCarrier.Lisr.Current it does not work and yes I am using a list of Carriers.


Hi Ricardo, just curious on how are the Form field variables are assigned and related to the Carrier.List?

Edwin Siruma wrote:

Hi Ricardo, just curious on how are the Form field variables are assigned and related to the Carrier.List?

Hi, I am no long using the form but I assigned the variables by assigning them to the form widget, e.g. 

CarrierForm.Record.carriers.Id



Hi Ricardo,

Back to the original description. You need to make sure that the inputs inside the Form are bound to the form. Is that the case?

A debug session with a breakpoint in a screen element should give useful insight on what may be wrong.


Cheers,

Tiago.

Tiago,

The issue that Ricardo has raised was encountered by us on a project that required dynamic switching between web blocks on a single page.

If the aggregate in the preparation was not assigned to the form then no data would be displayed.

Something that I noticed in the initial post is that there is a Silk UI widget inside the form with the fields inside the widget which is a pattern that was followed on the web blocks that gave us issues.

Unfortunately, I don't have access to the solution so I will try and replicate the issue this weekend.

Ouen 


Hi people,

Let me explain in more detail what J answered.

1. Form is in the page.

When you LOAD a page (navigate to it), after the preparation, the page starts to be built. When server encounters the Form, It bounds the source to it automatically.

On any Submit (page will be built again) or Ajax Submit (with Ajax refresh of the form), server notices that it is NOT a page loading, and DO NOT bound again the source to the form.

2. Form is in a web block, not built on page loading.

On any Submit (page will be built again) or Ajax Submit (with Ajax refresh of the form), in which the web block will now be built, server notices that it is NOT a page loading, and DO NOT bound again the source to the form.

This is by design. The idea is to prevent that the form loses any data inserted by the user, what would happen in many situations, like input validation failing, where you do not save data and want to keep user inputs. If the form went looking for data again, it would overwrite user inputs.

So, on both situations, if you want to change or set form content, an explicit bound through assignment is needed, be for the source, be for specific Form record attributes.

Hope the explanation is good enough for you to understand what is happening.

Cheers