user2684452
user2684452

Reputation: 731

how to only allow text in parsely.js validation

I am using the nifty parsley js As you can see in the documentation there is only data-parsley-type="alphanum" which allows numbers and letters. I am trying to create fields that ONLY allow letters.

Anyone know how to do this?

Upvotes: 5

Views: 6686

Answers (2)

mounir
mounir

Reputation: 11

You can use such input validator, in order to obtain an only letter field.

<input type="text" class="form-control" required data-parsley-pattern="^[a-zA-Z ]+$" placeholder="Type something" />

Upvotes: 0

rid
rid

Reputation: 63442

You could use a pattern:

data-parsley-pattern="^[a-zA-Z]+$"

Upvotes: 19

Related Questions