Form Inside Web block has empty vases after submit server action

Form Inside Web block has empty vases after submit server action

  

Hi,

I have a screen with preparation and local list variable that is cleared and populated on preparation. On the screen I have a ListRecords with this local variable as source and a web block inside it. On the webBlock that has some id as input parameter and a preparation with the query result set as source for a form to display its values. When the screen is loaded first time all values are displayed correctly. However if I trigger a submit action on the screen or web block after page reload the form inside the web block is empty. I've debugged and all preparations are run correctly and received correct values. It seems that there is a problem when assigning a source record value to the form as they are empty.

I've managed to solve the problem by explicitly assign a record to a form widget in the web block preparation.

Is it a normal behaviour for the form component?

Thank you.

@Mykola

Which id are you passing to the webblock? The one associated to the ListRecord or the one from the List you are filling in the preparation?

Hi João,

Id from the ListRecords1.List.Current.XXXXId and on the debug the value is passed correctly and the query on preparation of the web block has correct results but they are not binded to the form. 

Hi Mykola,


you are correct


afaik it's a by-design-feature. (not that I agree with it)

For some reason it is cached and therfore you need to explicitly assign to it.


The reason is that a form, in a page or web block, only fetch data from the source on page loading.

So, a refresh of the web block will not make the form fetch the source data again.

The solution is to use an assign in the preparation of the web block explicitly assign the data source to the source property of the form.

The reason for this is to prevent the form to replace what was typed with the original data on a submit.

I agree that the platform could identify that it is a web block being refreshed and fetch again, but for now it doesn't.

Cheers