Hi, i’m trying to populate my form after send i will try with unload and load but it doesn’t work, here’s my code:
function formLoad(mapping, divId) {
var dhtmlxFormObj = new dhtmlXForm(divId);
dhtmlxFormObj.setSkin('dhx_skyblue');
dhtmlxFormObj.loadStruct(appContext + mapping, "json");
return dhtmlxFormObj;
}
this is the general form loader
function loadEditForm(id) {
var endPoint = "/formCrea";
if(id != '0') {
endPoint = "/formUpdate/" + id;
}
editUtForm = formLoad(endPoint, "utenteForm");
editUtForm.attachEvent("onButtonClick", function(name) {
if(name == "submitCrea")
creaUtente();
else
document.location = appContext + "/userEdit";
});
}
this is the function who callit.
[code]function creaUtente() {
editUtForm.send(appContext + “/creaUser”, “post”, function(loader, response){editHandling(loader, response);}, true);
}
function editHandling(loader, response) {
if(response.indexOf(“HTTP Status”) == -1) {
editUtForm.unload();
editUtForm = new dhtmlXForm(“utenteForm”, response)
flashMessage(“Utente creato con successo”);
}
}[/code]
this two function are the handler of the submit.
[
{"type":"settings","inputWidth":"auto","position":"label-left","labelWidth":"auto"},
{"type":"fieldset","name":"utente","label":"Utente","inputWidth":"auto","list":[
{"type":"label","name":"username","label":"User","inputWidth":"auto","value":"boxfox"},
{"type":"password","name":"password","label":"Password","inputWidth":"auto","value":"f3a1498a9c76f1779bf810234fe58e18b8e322f4d9e5b27d735d2046f9735740f5a29cfe0684b726"},
{"type":"password","name":"verifyPassword","label":"Password","inputWidth":"auto","value":"f3a1498a9c76f1779bf810234fe58e18b8e322f4d9e5b27d735d2046f9735740f5a29cfe0684b726"},
{"type":"hidden","name":"oldPassword","label":"oldPassword","inputWidth":"auto","value":"f3a1498a9c76f1779bf810234fe58e18b8e322f4d9e5b27d735d2046f9735740f5a29cfe0684b726"},
{"type":"input","name":"cognome","label":"Cognome","inputWidth":"auto","value":"Festuccia"},
{"type":"input","name":"nome","label":"Nome","inputWidth":"auto","value":"Alessandro"},
{"type":"select","name":"idRuolo","label":"Ruolo","inputWidth":"auto","options":[
{"value":"1","text":"Amministratore di sistema"},
{"value":"2","text":"Operatore di posta"},
{"value":"3","text":"Utente consultatore di posta"}
]},
{"type":"button","name":"submitCrea","label":"Crea","value":"Crea","offsetLeft":"0"}
]
}
]
this is the response.
<div id="utenteForm" style="vertical-align:top; height:500px;"></div>
this is the on page.
what do i wrong?