Client-side validate phone number fields

This commit is contained in:
Saku Laesvuori 2023-10-31 18:58:27 +02:00
parent bd1bcf51e9
commit c8610caa54
Signed by: slaesvuo
GPG Key ID: 257D284A2A1D3A32
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ telephoneField = Field
, fieldView = \id name otherAttributes result isRequired ->
let result' = either (\x -> x) renderPhoneNumber result
in [whamlet|
<input type="tel" id="#{id}" name="#{name}" value="#{result'}" *{otherAttributes} :isRequired:required="true">
<input type="tel" id="#{id}" name="#{name}" value="#{result'}" pattern="[+ 0123456789]*" title="Only '+', spaces and numbers are allowed" "*{otherAttributes} :isRequired:required="true">
|]
, fieldEnctype = UrlEncoded
}