How to load async created form into container?

I currently switch my app to using await/async instead of the nasty callbacks. I'm struggling with creating forms into containers. Before I used this:

MyForm := TMyForm.CreateNew('Contentainer',@OnFormCreated)

This worked well. Now I'm doing:

MyForm := TMyForm.CreateNew('Contentainer');
Await(TMyForm,MyForm.Load());

This now runs sync, but the new form is not showing up in the container. Instead, it is created at the end of the HTML.

What am I doing wrong?

Thanks alot!

Hi Walter
When/where are you calling TMyForm.CreateNew('Contentainer'? Is the element 'Contentainer' already present in the DOM before creating your form instance?

Thank you for jumping in! Yes, "Container" is defined. In the async version with the @OnFormCreated callback, all runs well.

Can you try this version?

MyForm := TMyForm.CreateNew('Contentainer', nil);
1 Like

Yeah, great, thank you, didn't see this. The interface of CreateNew() is a little ambiguous in that respect.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.