Skip to content

Incorrect field splitting in &validate parameter #276

@Ruslan-Aleev

Description

@Ruslan-Aleev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions