0

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.

5
  • 1
    130 fields… Make it into a multi step webform.
    – No Sssweat
    Aug 21, 2023 at 10:11
  • 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.
    – kazah
    Aug 21, 2023 at 10:45
  • 1
    130 field webform in a modal? You can set up wizard mode in Webform and disable the user controlled advancement.
    – Kevin
    Aug 21, 2023 at 13:49
  • ‘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.
    – No Sssweat
    Aug 21, 2023 at 18:16
  • I removed computed field module and rewrite it with hook_node_presave. Perfomance increased 10 times. Thanks to everyone.
    – kazah
    Aug 23, 2023 at 6:33

1 Answer 1

2

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.

1
  • Thank you! It will be great if Ajax request will be cacheable.
    – kazah
    Aug 23, 2023 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.