From abe62398b6edca0ba23e589e86b94f243d5ecd08 Mon Sep 17 00:00:00 2001 From: Christophe Robillard Date: Wed, 19 Aug 2020 14:55:44 +0200 Subject: [PATCH] very light client-side validation for phone --- .../dossiers/editable_champs/_phone.html.haml | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/app/views/shared/dossiers/editable_champs/_phone.html.haml b/app/views/shared/dossiers/editable_champs/_phone.html.haml index 5ef3c3dfa..888cdb944 100644 --- a/app/views/shared/dossiers/editable_champs/_phone.html.haml +++ b/app/views/shared/dossiers/editable_champs/_phone.html.haml @@ -1,23 +1,7 @@ -# Allowed formats: --# 0123456789 --# 01 23 45 67 89 --# 01.23.45.67.89 --# 0123 45.67.89 --# 0033 123-456-789 --# 0035 123-456-789 --# 0033 123-456-789 --# 0033(0)123456789 --# +33-1.23.45.67.89 --# +33 - 123 456 789 --# +33(0) 123 456 789 --# +33 (0)123 45 67 89 --# +33 (0)1 2345-6789 --# +33(0) - 123456789 --# +1(0) - 123456789 --# +2 123456789 --# 012345678 --# 01234567890 +-# very light validation is made client-side +-# stronger validation is made server-side = form.phone_field :value, placeholder: champ.libelle, required: champ.mandatory?, - pattern: "([\\+\\d\\(][\\(\\)\\s\\.\\-\\d]{4,}\\d)" + pattern: "[^a-z^A-Z]+"