1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-23 05:54:03 +01:00

Il panel dei componenti su articoli reinizializzava tutti i js

This commit is contained in:
Fabio Lovato 2018-01-25 17:08:10 +01:00
parent 824eb089a3
commit 127109ebb2
2 changed files with 13 additions and 6 deletions

View File

@ -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');

View File

@ -11,5 +11,5 @@ function genera_form_componente($contenuto)
$fields[$key] = '<div class="col-md-4">'.$value.'</div>';
}
echo $title.PHP_EOL.implode(PHP_EOL, $fields).PHP_EOL.'<script src="'.ROOTDIR.'/lib/init.js"></script>';
echo $title.PHP_EOL.implode(PHP_EOL, $fields).PHP_EOL.'<script>start_inputmask( "#info_componente" );</script>';
}