Storing a form from custom module in a variable

Occasional Contributor

Hi guys,


I'm trying to wrap my head around some forms stuff here. I've built a custom module in which I can select a form. In the code of the module, I can easily display the form.



{% form "testform" form_to_use="{{ row.formulier.form_id }}" response_response_type="{{ row.formulier.response_type }}" response_message="{{ row.formulier.message }}" response_redirect_id="{{ row.formulier.redirect_id }}" response_redirect_url="{{row.formulier.redirect_url}}"  %}

That will render the form on the page right at that point in the code. However, I'm trying to accomplish that this form is stored in a variable I can use at a later point in my code. Just like you would with text.


Is there a way to store this form with something like this?

{% set formvar = [the form code here...] %}

I checked out this thread by Craig, but it isn't really what I'm looking for:

Hope you can help me out 🙂

2 Replies 2
Community Manager

Hey @bartvintcent 


Sorry for the delay response 🙂 


I am wondering if you still having this issue. If so, I am pretty sure our Community experts can share their knowledge with you. 


Hey @Anton , @Craig and @Kevin-C could you please share your expertise with @bartvintcent ?


Thank you


¿Sabías que la Comunidad está disponible en Español?
¡Participa hoy en conversaciones en el idioma de tu preferencia,cambiando el idioma en tus configuraciones!

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !

Occasional Contributor

Hi @sharonlicari ,


The issue is still here 🙂

However, we found another way and dismissed the option of adding a form to a custom module. But, still interested to learn if this is something that can be solved.