From bf686278f22a8926399ae1ea58663033fdc09cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Tue, 16 Oct 2018 17:02:39 +0200 Subject: [PATCH] :sparkles: feat(attributes) Use tel input type for phone number fields issue #5910 --- .../simpleplugin/attributes/class_PhoneNumberAttribute.inc | 5 +++-- include/simpleplugin/attributes/class_StringAttribute.inc | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc b/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc index 320c7a584..539692c2d 100644 --- a/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc +++ b/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc @@ -110,8 +110,9 @@ class phoneSelectDialog extends GenericDialog */ class PhoneNumberAttribute extends TestValidateAttribute { - protected $trim = TRUE; - protected $testFunc = 'is_phone_nr'; + protected $trim = TRUE; + protected $testFunc = 'is_phone_nr'; + protected $inputType = 'tel'; } /*! \brief Displays a text field and a button to select the phone from object list diff --git a/include/simpleplugin/attributes/class_StringAttribute.inc b/include/simpleplugin/attributes/class_StringAttribute.inc index 97471ab52..575ae19ee 100644 --- a/include/simpleplugin/attributes/class_StringAttribute.inc +++ b/include/simpleplugin/attributes/class_StringAttribute.inc @@ -27,6 +27,7 @@ class StringAttribute extends Attribute protected $example; protected $autocomplete = NULL; protected $trim = FALSE; + protected $inputType = 'text'; /*! \brief The constructor of StringAttribute * @@ -69,7 +70,7 @@ class StringAttribute extends Attribute if ($this->autocomplete !== NULL) { $attributes['autocomplete'] = ($this->autocomplete ? 'on' : 'off' ); } - $display = $this->renderInputField('text', $id, $attributes); + $display = $this->renderInputField($this->inputType, $id, $attributes); return $this->renderAcl($display); } -- GitLab