Marvin Danig
Marvin Danig

Reputation: 3898

How to customize parsleyjs error message for alphanum & email type?

In the documentation of parsleyjs, it is asked to specify

data-parsley-'contraint'-message = "My message"

to get the desirable error message for a given field. I wish to customize the error message for a valid email and a valid alphanumeric type field in the form. I tried with,

'parsley-type-email-message' => 'Invalid format'

and

'parsley-type-alphanum-message' => 'Alphanumeric only'

based on old documentation but they do not seem to work.

What should I specify in constraint for each of these?

Upvotes: 2

Views: 1136

Answers (1)

Marvin Danig
Marvin Danig

Reputation: 3898

Got it! Use the following

'data-parsley-type-message' => 'Your message'

without specifying email or alphanum type in the data attribute because there is just one input field in question at a time.

The documentation for this here.

Upvotes: 3

Related Questions