Project

General

Profile

Actions

Bug #80481

closed

Story #69617: FormEngine bugs

FormEngine.Validation may access DOM too early

Added by Markus Klein over 7 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Backend JavaScript
Target version:
Start date:
2017-03-27
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:
Stabilization Sprint

Description

The initialization function of FormEngine.Validation is not registered as DOMready handler, but is called directly. This will cause problems on browsers with very fast JS evaluation, where the DOM is not yet ready.


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #80672: Saving problems in Chrome 57+Closed2017-04-04

Actions
Related to TYPO3 Core - Bug #80632: still issues with missing input in BEClosed2017-04-02

Actions
Related to TYPO3 Core - Bug #81520: form validation in backend not working onloadClosedMarkus Klein2017-06-08

Actions
Actions #1

Updated by Gerrit Code Review over 7 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52180

Actions #2

Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52180

Actions #3

Updated by Gerrit Code Review over 7 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52180

Actions #4

Updated by Gerrit Code Review over 7 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52180

Actions #5

Updated by Gerrit Code Review over 7 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52208

Actions #6

Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52208

Actions #7

Updated by Gerrit Code Review over 7 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52180

Actions #8

Updated by Gerrit Code Review over 7 years ago

Patch set 3 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52208

Actions #9

Updated by Gerrit Code Review over 7 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52180

Actions #10

Updated by Markus Klein over 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #11

Updated by José Ricardo over 7 years ago

I'm still getting the problem on TYPO3 7.6.18. Anyone else?

Actions #12

Updated by Markus Klein over 7 years ago

@josé: Can you please describe what error you see? What behaviour do you experience? Any log messages in console?

Actions #13

Updated by José Ricardo over 7 years ago

No errors logged.
Here at my office we don't see the error (just got it once), but our costumer reports that often some news records (tx_news) are saved without title. They use Google Chrome + Windows (we recommended they to use Firefox by now to see if the error incidence goes down). The only thing logged in sys_log is this kind of message (no errors on any log):

Record '[Sem título]' (tx_news_domain_model_news:414408) was inserted on page 'Acervo de Notícias' (3) (msg#1.1.10)

'Sem título' means 'No title' in brazilian portuguese.
This is an inconsistent error, since we couldn't find at the moment any pattern involving it.
As the title is the only required field and the only field which is lost after saving, i'm starting believing it could be related.

This is happening on about 5~10% of the records inserted and to all users.

Actions #14

Updated by Markus Klein over 7 years ago

Yes I can confirm this issue as well. I saw that myself too, but this is not a bug anymore in TYPO3, it's a matter of waiting long enough to let form initialize.
If you do not wait long enough and start typing too fast, then this can happen. I currently have no clue if this is fixable without blocking the user's view (like hiding everything) until all stuff is initialized properly.

Actions #15

Updated by Riccardo De Contardi over 7 years ago

That happened to me while creating a BE usergroup: the required field was actually saved as "[No title]"

This should be related, right? #80672

See also #80632 #80884

Actions #16

Updated by José Ricardo over 7 years ago

I confirm that it's a problem related to speed of user input against the form initialization.

On Chrome i've changed throttling preset to GPRS, so I cloud simulate a very slow connection. Before the form completed I was able to save the news record without selecting Categories (which are required in my project) and the title was lost.

Shouldn't TYPO3 block saving or typing anything on the forms before it's fully loaded? As there's no server-side validation of required fields, this behaviour could lead to errors on the system if those exceptions (like not having a category) are not handled.

Actions #17

Updated by Riccardo De Contardi over 7 years ago

Another possibly related: #77729

Actions #18

Updated by Riccardo De Contardi over 7 years ago

  • Parent task set to #69617
Actions #19

Updated by Christian Hillebrand over 7 years ago

just came in this trouble and my browser (google chrome) is telling me the following:

Uncaught TypeError: FormEngineValidation.registerReady is not a function
    index.php?route=%2Frecord%2Fedit&token=ab86687…&edit[tt_content][20…:155 
    at index.php?route=%2Frecord%2Fedit&token=ab86687…&edit[tt_content][20…:155
    at Object.execCb (require-1604a50….js:1)
    at t.check (require-1604a50….js:1)
    at t.<anonymous> (require-1604a50….js:1)
    at require-1604a50….js:1
    at require-1604a50….js:1
    at each (require-1604a50….js:1)
    at t.emit (require-1604a50….js:1)
    at t.check (require-1604a50….js:1)
    at t.enable (require-1604a50….js:1)

and
Uncaught TypeError: FormEngine.setBrowserUrl is not a function
    index.php?route=%2Frecord%2Fedit&token=ab86687…&edit[tt_content][20…:149 
    at index.php?route=%2Frecord%2Fedit&token=ab86687…&edit[tt_content][20…:149
    at Object.execCb (require-1604a50….js:1)
    at t.check (require-1604a50….js:1)
    at t.<anonymous> (require-1604a50….js:1)
    at require-1604a50….js:1
    at require-1604a50….js:1
    at each (require-1604a50….js:1)
    at t.emit (require-1604a50….js:1)
    at t.check (require-1604a50….js:1)
    at t.<anonymous> (require-1604a50….js:1)


when i check the script at this position, there is:

/*RequireJS-Module-TYPO3/CMS/Backend/FormEngined935ebd2ae27fe1f92ebe73abca953afd001513e*/
require(["TYPO3/CMS/Backend/FormEngine"], function(FormEngine) {
            FormEngine.setBrowserUrl('\/typo3\/index.php?route=%2Fwizard%2Frecord%2Fbrowse\u0026token=2836d0b1a12176fd49ebe29df35a23dc2679be42');
        });

/*RequireJS-Module-TYPO3/CMS/Backend/FormEngineValidationdfe861477e946addc2b2ba604b52bdb6630146a5*/
require(["TYPO3/CMS/Backend/FormEngineValidation"], function(FormEngineValidation) {
            FormEngineValidation.setUsMode(0);
            FormEngineValidation.registerReady();
        });

While i am on the URL: https://..../typo3/index.php?route=%2Fmain&token=101e14d3018533802a55e2129cc0bc855c62e67e

does this maybe matter?

on firefox i get allmost the same ... just another set of token

Actions #20

Updated by Markus Klein over 7 years ago

@Christian: Can you please flush your browser's cache! There is actually no other cause for your errors, because the missing functions have been added and are new. Since your browser does not know them, it is clear it uses old files.

Actions #21

Updated by Markus Klein over 7 years ago

  • Related to Bug #80672: Saving problems in Chrome 57+ added
Actions #22

Updated by Markus Klein over 7 years ago

  • Related to Bug #80632: still issues with missing input in BE added
Actions #23

Updated by Markus Klein over 7 years ago

Please continue in #80672.

Actions #24

Updated by Christian Hillebrand over 7 years ago

i even installed an update in chrome ... so i restarted chrome multiple times ... it did not changed anything ... i wasn't able to see any form contents

now ... 30 minutes later it seems to work again ... without doing anything further :P

Actions #25

Updated by Markus Klein over 7 years ago

Updating Chrome does not flush its caches ;-)

Actions #26

Updated by Christian Hillebrand over 7 years ago

i did not flush the cache manually at any time - but its working now for any reason ;)

and i used the developer tools with "disable cache" enabled

Actions #27

Updated by Oliver Hader over 7 years ago

  • Related to Bug #81520: form validation in backend not working onload added
Actions #28

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF