From 127109ebb242ed24242ddfa28b7855b8a6d4fd51 Mon Sep 17 00:00:00 2001 From: Fabio Lovato Date: Thu, 25 Jan 2018 17:08:10 +0100 Subject: [PATCH] Il panel dei componenti su articoli reinizializzava tutti i js --- lib/functions.js | 17 ++++++++++++----- modules/my_impianti/modutil.php | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/functions.js b/lib/functions.js index 3157c3d5e..7f1f25b39 100644 --- a/lib/functions.js +++ b/lib/functions.js @@ -985,22 +985,29 @@ jQuery.fn.selectData = function () { }; // Inputmask -function start_inputmask() { +function start_inputmask(element) { + if( element == undefined ){ + element = ''; + } else { + element = element + ' '; + } + var date = moment.localeData().longDateFormat('L').toLowerCase(); - $(".date-mask").inputmask(date, { + + $(element+".date-mask").inputmask(date, { "placeholder": date }); - $('.email-mask').inputmask('Regex', { + $(element+'.email-mask').inputmask('Regex', { regex: "^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^-]+(?:\\.[a-zA-Z0-9_!#$%&'*+/=?`{|}~^-]+)*@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$", }); if (isMobile.any()) { - $('.inputmask-decimal, .date-mask, .timestamp-mask').each(function () { + $(element+'.inputmask-decimal, '+element+'.date-mask, '+element+'.timestamp-mask').each(function () { $(this).attr('type', 'tel'); }); } else { - $('.inputmask-decimal').each(function () { + $(element+'.inputmask-decimal').each(function () { var $this = $(this); var min = $this.attr('min-value'); diff --git a/modules/my_impianti/modutil.php b/modules/my_impianti/modutil.php index 6c1be401b..90314cef4 100644 --- a/modules/my_impianti/modutil.php +++ b/modules/my_impianti/modutil.php @@ -11,5 +11,5 @@ function genera_form_componente($contenuto) $fields[$key] = '
'.$value.'
'; } - echo $title.PHP_EOL.implode(PHP_EOL, $fields).PHP_EOL.''; + echo $title.PHP_EOL.implode(PHP_EOL, $fields).PHP_EOL.''; }