We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Programmatic form ID

Univers January 28, 2020 by Univers

I'm currently referencing a default form in a partial. I'd like the ability to have the id attr be added programmatically, ideally by referencing a variable in the partial.

The following below works:

{{ partial src="blocks/contact-form" 
          form_id="contact-form"
 }}

/* blocks/contact-form */
{{ form:create formset="contact-form" attr="id:{form_id}}" }
          .... form inputs etc...
{{ /form:create }}

This is great, but is there a way to extend this to have a fallback value? I.e the equivalent of:

{{ if form_id }}
{{ form_id }}
{{ else }}
fallback_id
{{ /if }}

Thanks for your help :~)

Answered by Univers!
>>>>>>> Answered <<<<<<<
2 Replies
2 Followers