Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Why do theme functions only run once?

Started by Jayesh Gohel 9 years ago · 3 replies · 1011 views
9 years ago

I am trying to set a default value in a form using static Theme function. However it seems theme functions only execute once, a page refresh does not update the page values.

9 years ago

Have you disabled the (twig) cache for this page?

9 years ago

Yes I have set cache_enable: false. Here's the folder structure for your reference -

YAML
- 01.home
  - default.md
- 02.demo
  - form.md

Frontmatter for form.md (under 02.demo folder) is as follows -

YAML
---
title: Demo
cache_enable: false
form:
  fields:
    - name: name
      type: text
      label: Hello World
      data-default@: ['\Grav\Theme\Antimatter::getQuery', 'product']
---
9 years ago

Seems like this problem has been around for some time.
/forum/forms-blueprints/form-field-set-by-url-parameter-t9281?u=gnat

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Japhy, 2 weeks ago
2 269 4 days ago
Forms & Blueprints · by FrViPofm, 4 weeks ago
5 329 4 weeks ago
Forms & Blueprints · by Ton Haarmans, 6 years ago
13 2319 8 months ago
Forms & Blueprints · by Hugo Oliveira, 9 months ago
0 781 9 months ago
Forms & Blueprints · by Flachy Joe, 10 months ago
9 871 10 months ago