mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-02 17:07:01 +01:00
Correzioni minori sugli input JS
This commit is contained in:
parent
f0c3f12ea4
commit
a0b421b615
@ -21,11 +21,19 @@ function input(name) {
|
||||
}
|
||||
|
||||
function Input(name) {
|
||||
this.element = $("[name='" + name + "']").last();
|
||||
// Selezione tramite jQuery
|
||||
if (name instanceof jQuery) {
|
||||
this.element = name.last();
|
||||
}
|
||||
|
||||
// Fix per select multipli
|
||||
if (this.element.length === 0) {
|
||||
this.element = $("[name='" + name + "[]']").last();
|
||||
// Selezione per nome
|
||||
else {
|
||||
this.element = $("[name='" + name + "']").last();
|
||||
|
||||
// Fix per select multipli
|
||||
if (this.element.length === 0) {
|
||||
this.element = $("[name='" + name + "[]']").last();
|
||||
}
|
||||
}
|
||||
|
||||
// Controllo sulla gestione precedente
|
||||
@ -99,7 +107,7 @@ Input.prototype.getData = function () {
|
||||
}
|
||||
|
||||
return {
|
||||
value: this.element.val()
|
||||
value: this.get()
|
||||
};
|
||||
}
|
||||
|
||||
@ -108,10 +116,16 @@ Input.prototype.get = function () {
|
||||
|
||||
// Conversione del valore per le checkbox
|
||||
let group = this.element.closest(".form-group");
|
||||
if (group.find("input[type=checkbox]").length){
|
||||
if (group.find("input[type=checkbox]").length) {
|
||||
value = parseInt(value) ? 1 : 0;
|
||||
}
|
||||
|
||||
// Gestione dei valori numerici
|
||||
const autonumeric = this.element.data("autonumeric");
|
||||
if (autonumeric) {
|
||||
value = parseFloat(autonumeric.rawValue);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user