I am using knockoutjs and knockout validation. I am attempting to restrict semicolons from being entered. I have tried this:
.extend({ pattern: { params: "[^;]"} });
..somehow when I enter 'pppppp' into my text input it is considered invalid. but 'eee' is valid, please help?
Thanks!
It would appear that you need to include a custom message, or not use a wrapping object.
Check out this js fiddle.
The following constructions are valid:
.extend({
pattern: {
params: '^[^;]*$'
, message:"fail"
}
})
or
extend({
pattern: '^[^;]*$'
})
However, this results in unexpected behaviour:
.extend({
pattern: {
params: '^[^;]*$'
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With