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

Incorrect field splitting in &validate parameter #276

Open
Ruslan-Aleev opened this issue Nov 30, 2022 · 1 comment
Open

Incorrect field splitting in &validate parameter #276

Ruslan-Aleev opened this issue Nov 30, 2022 · 1 comment

Comments

@Ruslan-Aleev
Copy link

Bug report

Summary

The fields in the &validate parameter are separated by commas.
And if there is an extra character before / after the field (space, line break, etc.), then field validation does not work.
Clearly uncoordinated field splitting, it's worth adding a trim() or something like that.

Step to reproduce

For example, if you set the parameter like this, validation of the last field (message) does not work.

&validate=`
name:required,
email:email,
phone:required,
message:required
`

form_1

But if you remove the line break, then everything will work:

&validate=`
name:required,
email:email,
phone:required,
message:required`

form_2

Observed behavior

Field validation does not work.

Expected behavior

Validation should work.

Environment

Related issue - #251

FormIt 4.2.7-pl
MODX 2.8.4

@Ruslan-Aleev
Copy link
Author

Ruslan-Aleev commented Nov 30, 2022

Validation will work if add a comma at the end of the field, but, as I understand it, it's just that now the validation also happens for an extra empty field.

&validate=`
name:required,
email:email,
phone:required,
message:required,
`

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

1 participant