CalderaWP / Caldera-Forms

Drag and drop, responsive WordPress form builder.
https://CalderaForms.com
GNU General Public License v2.0
187 stars 163 forks source link

Explicit Browser-Reload on Form page leads to pre filled out input fields but empty summary/ mails #2734

Closed utrautmann closed 6 years ago

utrautmann commented 6 years ago

Is This A Feature Request?

No, it's a bug

What Version Of Caldera Forms, WordPress and PHP Are You Using?

WordPress Version: 4.9.8PHP Version: 7.1.19-nmm1MySQL Version: 5.7.21Caldera Forms Version: 1.7.2WP_DEBUG: 1

Does Your Issue Persist When You Disable All Other Plugins and Switch To The Default Theme?

I can replay the behaviour in all Caldera Form Examples - see https://calderaforms.com/examples/

What Is The Unexpected Behaviour?

Scenario (Firefox):

  1. User fills out the form, but doesn't submit (see Screen 1)
  2. User hit Browser "Reload" function on any form page
  3. Form shows the entered values again!!! (only in not calculated fields)
  4. Submit is now possible, but email-fields are empty. No values are transmitted. Summary-element showed empty values too (Screen 2). And all fields with magic slugs (%) doesn't shown the input values.

So, with this behaviour user can send the form with empty values and required fields are ignored.

Screen 1 (Filled out before reloading) grafik

Screen 2 (After F5 reloading) grafik

What JavaScript Errors Have You Seen While Reproducing This Bug?

Nothing

utrautmann commented 6 years ago

It seems to be this Firefox bug: https://stackoverflow.com/questions/24556165/how-to-clear-form-data-on-refresh-of-age-in-firefox

I've cleared now the form with own JS when page is loading. (inserted in certain page in Wordpress with Caldera Form - i've use the plugin AddFunc Head & Footer Code) It works:

for(var i=0; i<document.forms.length; ++i) document.forms[i].reset();

The workarround to set autocomplete to "off" at form- or input-element didn't help: setAttribute("autocomplete", "off");