You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.0 KiB
JavaScript
67 lines
2.0 KiB
JavaScript
if(typeof objectForm != 'undefined'){
|
|
window.__forms = function (prop = {}) {
|
|
var formMaker = objectForm.data.map(function (e) {
|
|
var obj = null;
|
|
|
|
if (prop[e.name] != undefined) {
|
|
if (prop[e.name].data != undefined) {
|
|
e.data = prop[e.name].data.map(function (c) {
|
|
return {
|
|
id: c.id,
|
|
text: c.text
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
if (e.type == 'text') {
|
|
obj = typeInput(e);
|
|
}
|
|
else if (e.type == 'date') {
|
|
obj = typeInput(e);
|
|
}
|
|
else if (e.type == 'telp') {
|
|
obj = typeInput(e);
|
|
}
|
|
else if (e.type == 'email') {
|
|
obj = typeInput(e);
|
|
}
|
|
else if (e.type == 'password') {
|
|
obj = typeInput(e);
|
|
}
|
|
else if (e.type == 'number') {
|
|
obj = typeNumber(e);
|
|
}
|
|
else if (e.type == 'select') {
|
|
obj = typeSelect(e);
|
|
}
|
|
else if (e.type == 'radio') {
|
|
obj = typeRadio(e);
|
|
}
|
|
return {
|
|
dat: e,
|
|
e: obj
|
|
};
|
|
});
|
|
_id(objectForm.idform).innerHTML = '';
|
|
if (objectForm.formsCustome === true){
|
|
_id(objectForm.idform).className = '';
|
|
}
|
|
formMaker.forEach(function (elemen) {
|
|
if (elemen.dat.type == 'line') {
|
|
_id(objectForm.idform).appendChild(
|
|
div().class('col-12')
|
|
.css({
|
|
borderBottom: `1px solid #dddddd`,
|
|
marginBottom: `15px`,
|
|
}).get()
|
|
);
|
|
} else {
|
|
_id(objectForm.idform).appendChild(elemen.e)
|
|
}
|
|
});
|
|
}
|
|
__forms();
|
|
}
|
|
|