[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 05/15: New 0001893: Date remplacement auto de
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 05/15: New 0001893: Date remplacement auto des séparateurs |
Date: |
Fri, 5 Feb 2021 11:38:29 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit d13d29f623581450d4c8abde7a3a4f8d1864311c
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Jan 29 12:20:53 2021 +0100
New 0001893: Date remplacement auto des séparateurs
---
html/js/scripts.js | 10 ++++++++++
include/lib/idate.class.php | 9 ++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 04cc00b..5fce465 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -330,6 +330,16 @@ function format_number(obj, p_prec)
$(obj).value = value;
}
+
+/**
+ * Replace slash and minus by dot
+ * @param p_object
+ */
+function format_date(p_object)
+{
+ p_object.value=p_object.value.replace(/\//g,'.');
+ p_object.value=p_object.value.replace(/-/g,'.');
+}
/**
*@brief check if the object is hidden or show and perform the opposite,
* show the hidden obj or hide the shown one
diff --git a/include/lib/idate.class.php b/include/lib/idate.class.php
index 8eab4fd..7d9d8a3 100644
--- a/include/lib/idate.class.php
+++ b/include/lib/idate.class.php
@@ -132,7 +132,7 @@ class IDate extends HtmlInput
return $this->display();
if ($this->id=="")
$this->id=self::generate_id($this->name);
$autofocus=($this->autofocus)?" autofocus ":"";
-
+ $onchange='onchange="format_date(this)"';
$r=sprintf('
<input type="text" name="%s" id="%s"
class="input_text"
@@ -140,14 +140,17 @@ class IDate extends HtmlInput
value ="%s"
placeholder="%s"
title="%s"
- pattern="[0-9]{1,2}.[0-9]{1,2}.[0-9]{4}"
+ pattern="[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}"
+ %s
/>
<span class="smallbutton icon"
id="%s_trigger"
/>

</span>
-
',$this->name,$this->id,$this->value,$this->placeholder,$this->title,$this->id
+
',$this->name,$this->id,$this->value,$this->placeholder,$this->title,
+ $onchange,
+ $this->id
);
// @see calendar-setup.js
$r.=sprintf('<script type="text/javascript">
- [Noalyss-commit] [noalyss] branch master updated (ce0a8f8 -> 79ecb68), Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 01/15: Fix #0001277: <<header>> ne supporte pas caractères avec accent., Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 03/15: Cosmetic, Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 02/15: SQL upgrade, Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 06/15: Fix: bug in gettext function, Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 05/15: New 0001893: Date remplacement auto des séparateurs,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 09/15: Set Version 8.1 + logo + bug SQL script 151, Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 12/15: Compatibility PHP7.0, Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 04/15: New : 0001890: Avertissement si la document à télécharger est trop gros, on ne peut soumettre le fichier, Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 07/15: ICard Improve doc and test, Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 08/15: New : Task #1894: Gestion : ajout un champs paramétrable pour videoconf, Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 11/15: Fix : Menu problem when 2 duplicate menus, Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 14/15: cosmetic : position inner_box on larger screen, Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 10/15: Place of recover_link, Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 15/15: We split Database in DatabaseCore and Database, Dany De Bontridder, 2021/02/05
- [Noalyss-commit] [noalyss] 13/15: Bug = if double click on a card returns nothing, Dany De Bontridder, 2021/02/05