Score:0

Loading webform in modal is too slow

in flag

I have webform with near 130 fields (text, entity checkboxes, radios, composite, etc)

Use it in modal:

<a href="/my-form?title={{node.id}}" class="webform-dialog" data-dialog-options="{&quot;width&quot;:465,&quot;resizable&quot;:&quot;false&quot;,&quot;hide&quot;:&quot;fadeOut&quot;}">click to open</a>    

It tooks near 9 seconds to load it.

Interal and Dynamic page cache enabled. Js and css aggregation enabled.

Opens webform on it's own page and if page is cached then it tooks 2 sec to load (all page, not only form).

So I think the problem is in cache.

How can I cache ajax response or how to solve this issue?

Thanks in advance.

No Sssweat avatar
ua flag
130 fields… Make it into a multi step webform.
kazah avatar
in flag
Multistep is not usefull because user could't go to any tab. I think I found the bottleneck... I use computed field in views that renders entity radios. Its load time is about 1 sec. I have four fields. So I need to investigate why computed field time is so long.
Kevin avatar
in flag
130 field webform in a _modal_? You can set up wizard mode in Webform and disable the user controlled advancement.
No Sssweat avatar
ua flag
‘Multistep is not usefull because user could't go to any tab’ If I remember correctly they should be able to, but only to steps that have already been completed.
kazah avatar
in flag
I removed computed field module and rewrite it with hook_node_presave. Perfomance increased 10 times. Thanks to everyone.
Score:2
cn flag

The core team is working on cacheable Ajax requests. The first project using it is Views. Modals might be next.

Until then you could deliver the hidden webform together with the cached page and unhide it with javascript, like jQuery Modal or Bootstrap's modal component.

Alternatively, make a custom jQuery.ajax() call pointing at your own controller which returns the rendered web form in a cacheable response.

kazah avatar
in flag
Thank you! It will be great if Ajax request will be cacheable.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.