Hi everyone,
I noticed a little bug when using a pattern validator in a text field.
The input element is always surrounded with red border, even if the value is valid.
Could you please post your field yaml?
Sure, here it is :
fields:
code:
label: Type de redirection
type: select
required: true
default: '301'
translate: false
options:
- value: '301'
text: 301 (Redirection permanente)
- value: '410'
text: 410 (Page supprimée)
- value: '307'
text: 307 (Redirection temporaire)
old_url:
autofocus: true
type: text
label: Ancienne url
pattern: ^\/
required: true
translate: false
icon: url
help: Utiliser une url relative démarrant par un slash (/)
new_url:
label: Nouvelle URL
translate: false
pattern: ^\/
type: text
required: true
icon: url
help: Utiliser une url relative démarrant par un slash (/)
Your pattern only matches the character /
and nothing after that.
pattern: ^\/.*
Oh you’re right.
What is weird is that i still can save when string only start with /
Thank you so much
This should throw an error when the input doesn’t match:
validate:
match: /^\/.*/