Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parsley error messages disappear after every ajax call #19

Open
blueamerican opened this issue May 24, 2018 · 8 comments
Open

parsley error messages disappear after every ajax call #19

blueamerican opened this issue May 24, 2018 · 8 comments

Comments

@blueamerican
Copy link

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
Copy link
Author

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
Copy link

j6s commented Sep 6, 2018

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

Basics

Quick refresher on how powermail_cond works:

  • User enters data
  • Browser sends data to backend
  • Backend answers with resolved conditions and instructions to show or hide fields / pages.
  • Browser executes those instructions and shows or hides fields / pages.

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
Copy link

j6s commented Sep 6, 2018

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
Copy link

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
Copy link

lapierrec commented Oct 1, 2019

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
Copy link

hhchrizzo commented Apr 23, 2020

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
Copy link

webmasterinfoklick commented Jul 17, 2020

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants