in2code-de / powermail_cond

Add conditions (via AJAX) to TYPO3 powermail forms for fields and pages
8 stars 23 forks source link

parsley error messages disappear after every ajax call #19

Closed blueamerican closed 2 months ago

blueamerican commented 6 years ago

Error messages, which are shown before the powermail_condition ajax call is fired, immediatly disappear with the ajax call.

For usabilty reasons this not acceptable for the user.

powermail 5.6 powermail_cond 4.1.1 TYPO3 8.7.13

blueamerican commented 6 years ago

same in:

powermail 6.0.0 powermail_cond 5.0.0 TYPO3 8.7.15

line 286 in: powermail_cond\Resources\Private\JavaScript\PowermailCondition.js

$formElement.parsley();

it seems for me, that this does'nt work.

j6s commented 6 years ago

Having the same issue I decided to dig a little deeper into why this is happening.

Basics

Quick refresher on how powermail_cond works:

Problem

The problem arises because the PowermailCondition script also reinitializes parsley if it has been activated resulting in previous error messages being hidden again.

Solution

The solution seems to be simple: Don't reinitialize parsley. Since the elements are not moved in and out of the DOM - only hidden and shown again parsley does not need to be reinitialized as it already knows of all new input elements. Removing the whole block for reinitializing parsley seems to fix the issue.

@einpraegsam direct question: Is there something I am missing about parsley being reinitialized?

j6s commented 6 years ago

I have opened #24 which solves this issue by removing parsley reinitialization. Another solution would be to update parsley to > 2.8 and use the refresh method as indicated here: http://parsleyjs.org/doc/#usage-form

mfvetter commented 5 years ago

Thanks @j6s! The solution to don't reinitialize parsley worked for me.

This parsley issue also affects the usability when using Tabs (or Steps). When validating the form, and an invalid field exists in another tab/step, the tab/step doesn't get activated automatically to show the error to the user, leaving the user clueless about why the form is not sending.

By commenting out the line reInitializeParsleyValidation(); in the file PowermailCondition.js, the issue was fixed.

Thanks! I hope #24, gets merged in the next release.

lapierrec commented 5 years ago

Hi, I met the same problème and the correction #24 works for me. Thanks! I have version 8.7.27 of TYPO3 and version 7.3.1 of PowerMail.

hhchrizzo commented 4 years ago

Is this still working in v 7.0.0 ?

I removed the lines from /Private/JavaScript/PowermailCondition.js (with reInitializeParsleyValidation)

The TS loads the /Public/PowermailCondition.min.js by default (i execpted this file is generated from PowermailCondition.js) Resources/Public/JavaScript/PowermailCondition.min.js (without reInitializeParsleyValidation in there) I dont get it.

webmasterinfoklick commented 4 years ago

I have the same problem running Powermail 7.4 & conditions 7.0, Typo3 9.5. Using AJAX or not, it happens in both cases.

Uncommenting does not work. The minified version is missing the reInitializeParsleyValidation() function and does not seem to be generated from PowermailConditions,js...?

wnzirngibl commented 2 years ago

Still having this issue on TYPO3 10.4 with powermail 8.4.1 and powermail_cond 8.2.2

Removing the reInitializeParsleyValidation() call as in #24 fixes it for me, but causes another issue - if the fields in a form change because of Powermail Conditions, you might end up with one empty required field with an error message and one without. That could be confusing for the user as well.

Would be perfect if parsley could only be reinitialized when fields are getting added or removed by Powermail Conditions - but I couldn't find out how to get that working.

mschwemer commented 2 months ago

Current supported versions of powermail do not use parsley any more.

So I close this issue.