Form disapears after a while

again some issue with the forms :frowning:

  1. I use forms a lot …
  2. I have a form in the footer on every page.
  3. All pages are modular page.

Everything visible and defined in the frontmatter disapperas after a while (approx. 2h).
Only the form-html with the hidden input-fields for __unique_form_id__ and form-nonce etc. gets rendered.

The footer is a template-partial and loads the form with this include
{% include "forms/form.html.twig" with { 'form': forms('footer-form') } %}

I guess it has something to do with caching.
So what are the ideal values for the different caching layers when I want to use forms?

from my current system.yaml:

pages:
  expires: 3600
[...]
cache:
  enabled: true
  check:
    method: file
  driver: auto
  prefix: g
  cli_compatibility: false
  lifetime: 3600
  gzip: true
  allow_webserver_gzip: true
twig:
  cache: false
  debug: false
  auto_reload: true
  autoescape: false
  undefined_functions: true
  undefined_filters: true
  umask_fix: false

from my footer-form.md-frontmatter

cache_enable: false

this is how the renderd “form” looks like:

<form name="" action="" method="POST" class=" ">

  
  
  <input type="hidden" name="__form-name__" value="">
  
    <div class="buttons">
  
  
    </div>
  
  <input type="hidden" name="__unique_form_id__" value="vkU0XcdsmPtQfp2x6RHZ">  <input type="hidden" name="form-nonce" value="f4b5012d54a59c62de78d4d4486bab85">
</form>

and this is how the forms gets renderd directly after clearing the cache:

<form name="footer-form" action="" method="POST" id="footer-form" class=" row 50%">

  
              

    <div class="form-field 3u 12u(mobilep)  ">
                                    <div class="form-label ">
                    <label class="inline">
                                                                                                        Anrede
                                                    
                        <span class="required">*</span>
                                        </label>
                </div>
                        <div class="form-data " data-grav-selectize="[]" data-grav-field="select" data-grav-disabled="true" data-grav-default="null">
                                        <div class="form-select-wrapper  ">
        <select name="data[Anrede]" class=" " required="required">
            <option value="" disabled="" selected="">Anrede</option>
                                                            <option value="Frau">Frau</option>
                                                            <option value="Herr">Herr</option>
                    </select>
    </div>
                                
            </div>
            </div>
              

    <div class="form-field 9u 12u(mobilep)  ">
                                    <div class="form-label ">
                    <label class="inline">
                                                                                                        Name
                                                    
                        <span class="required">*</span>
                                        </label>
                </div>
                        <div class="form-data " data-grav-field="text" data-grav-disabled="true" data-grav-default="null">
                                                            <div class="form-input-wrapper  ">
                                                        <input name="data[Name]" value="" type="text" class=" " placeholder="Vor-/Nachname" required="required">
                                                                                    </div>
                    
                                
            </div>
            </div>
              

    <div class="form-field 12u  ">
                                    <div class="form-label ">
                    <label class="inline">
                                                                                                        eMail
                                                    
                        <span class="required">*</span>
                                        </label>
                </div>
                        <div class="form-data " data-grav-field="email" data-grav-disabled="true" data-grav-default="null">
                                                            <div class="form-input-wrapper  ">
                                                        <input name="data[eMail]" value="" type="email" class=" " placeholder="eMail" required="required">
                                                                                </div>
                                                    
            </div>
            </div>
              

    <div class="form-field 6u 12u(mobilep)  ">
                                    <div class="form-label ">
                    <label class="inline">
                                                                                                        Anreise
                                                    
                        <span class="required">*</span>
                                        </label>
                </div>
                        <div class="form-data " data-grav-field="text" data-grav-disabled="true" data-grav-default="null">
                                                            <div class="form-input-wrapper  ">
                                                        <input name="data[Ankunft]" value="" type="text" class=" " placeholder="Anreise (TT.MM.JJJJ)" required="required" pattern="^([1-9]|0[1-9]|[12][0-9]|3[01])\.([1-9]|0[1-9]|1[012])\.(20)?\d{2}$" title="kein gültiges Datum oder Format (TT.MM.JJJJ)">
                                                                                    </div>
                    
                                
            </div>
            </div>
              

    <div class="form-field 6u 12u(mobilep)  ">
                                    <div class="form-label ">
                    <label class="inline">
                                                                                                        Abreise
                                                    
                        <span class="required">*</span>
                                        </label>
                </div>
                        <div class="form-data " data-grav-field="text" data-grav-disabled="true" data-grav-default="null">
                                                            <div class="form-input-wrapper  ">
                                                        <input name="data[Abreise]" value="" type="text" class=" " placeholder="Abreise (TT.MM.JJJJ)" required="required" pattern="^([1-9]|0[1-9]|[12][0-9]|3[01])\.([1-9]|0[1-9]|1[012])\.(20)?\d{2}$" title="kein gültiges Datum oder Format (TT.MM.JJJJ)">
                                                                                    </div>
                    
                                
            </div>
            </div>
              

    <div class="form-field 6u 12u(mobilep)  ">
                                    <div class="form-label ">
                    <label class="inline">
                                                                                                        Anzahl Erwachsene
                                                    
                        
                                        </label>
                </div>
                        <div class="form-data " data-grav-field="text" data-grav-disabled="true" data-grav-default="null">
                                                            <div class="form-input-wrapper  ">
                                                        <input name="data[Anzahl Erwachsene]" value="" type="text" class=" " placeholder="Anzahl Erwachsene">
                                                                                    </div>
                    
                                
            </div>
            </div>
              

    <div class="form-field 6u 12u(mobilep)  ">
                                    <div class="form-label ">
                    <label class="inline">
                                                                                                        Anzahl Kinder
                                                    
                        
                                        </label>
                </div>
                        <div class="form-data " data-grav-field="text" data-grav-disabled="true" data-grav-default="null">
                                                            <div class="form-input-wrapper  ">
                                                        <input name="data[Anzahl Kinder]" value="" type="text" class=" " placeholder="Anzahl Kinder">
                                                                                    </div>
                    
                                
            </div>
            </div>
              
<input data-grav-field="hidden" data-grav-disabled="false" type="hidden" class="input" name="data[url]" value="/">
              

    <div class="form-field 12u  ">
                                    <div class="form-label ">
                    <label class="inline">
                                                                                                        Nachricht
                                                    
                        
                                        </label>
                </div>
                        <div class="form-data " data-grav-field="textarea" data-grav-disabled="true" data-grav-default="null">
                                        <div class="form-textarea-wrapper  ">
        <textarea name="data[Nachricht]" class=" " placeholder="Nachricht" rows="4"></textarea>
    </div>
                                
            </div>
            </div>
              <input type="text" style="display:none;" name="data[spam]" value="">  
  <input type="hidden" name="__form-name__" value="footer-form">
  
    <div class="buttons">
  
                            <button class="button " type="submit">
                Anfrage abschicken
          </button>
                                            <button class="button alt" type="reset">
                zurück setzen
          </button>
                  
    </div>
  
  <input type="hidden" name="__unique_form_id__" value="SkxM7snK2YwDt8PTez4F">  <input type="hidden" name="form-nonce" value="f4b5012d54a59c62de78d4d4486bab85">
</form>

Same problem here, have you found a solution? Thanks in advance!

Please add (or modify) these frontmatter settings in the contact form page:

never_cache_twig: true
cache_enable: false

Does the problem still persist?

Will try and get back to you, thanks!

Finally, the problem persisted.

If it helps: I just tested the page/form using Incognito mode, and it seems to work good.

There is another proposal from @Andrass here:

Let’s move the conversation to the other thread. Cross-postings are rather confusing …