Thanks, It works ok now!
Now i’m trying to save the data loaded with some modifications. I tried to follow the standalone form step-by-step example, but I’m doing something wrong because the method save() does not work.
This is the code of the form:
///////Form
var formStructure = [
{ type:"fieldset" , name:"frm", label:"Formulario", width:500, labelAlign:"left", position:"", list:[
{ type:"settings" , labelWidth:"90", labelAlign:"right", position:"label-left" },
{ type:"input" , name:"id", label:"Id:", readonly:true, position:"" },
{ type:"input" , name:"titulo", label:"Título:", position:"" },
{ type:"colorpicker" , name:"backcolor", label:"Color de fondo:", value:"#FFFFFF", imagePath:'dhtmlx/dhtmlxColorPicker/codebase/imgs/', position:"" },
{ type:"file" , name:"encabezado", label:"Encabezado:", position:"" },
{ type:"file" , name:"descripcion", label:"Descripción:", position:"" },
{ type:"file" , name:"fondo", label:"Fondo:", position:"" },
{ type:"file" , name:"cartel", label:"Carteles:", position:"" }
] },
{ type:"fieldset" , name:"mail", label:"Mail", width:500, position:"", list:[
{ type:"input" , name:"subject_mail", label:"Subject:", inputWidth:"350", inputHeight:"60", position:"" },
{ type:"input" , name:"html_mail", label:"Cuerpo (html):", inputWidth:"350", inputHeight:"60", position:"" },
{ type:"settings" , labelWidth:"90", labelAlign:"right", position:"label-left" }
] },
{ type:"fieldset" , name:"facebook", label:"Facebook", width:500, position:"", list:[
{ type:"input" , name:"titulo_facebook", label:"Título:", inputWidth:"350", position:"" },
{ type:"input" , name:"link_facebook", label:"Link:", inputWidth:"350", position:"" },
{ type:"input" , name:"mensaje_facebook", label:"Mensaje:", inputWidth:"350", inputHeight:"60", position:"" },
{ type:"settings" , labelWidth:"90", labelAlign:"right", position:"label-left" }
] },
{ type:"fieldset" , name:"twitter", label:"Twitter", width:500, position:"", list:[
{ type:"settings" , labelWidth:"90", labelAlign:"right", position:"label-left" },
{ type:"input" , name:"mensaje_twitter", label:"Mensaje:", inputWidth:"350", inputHeight:"60", position:"" }
] },
{ type:"fieldset" , name:"soinco", label:"Sónico", width:500, position:"", list:[
{ type:"input" , name:"titulo_sonico", label:"Título:", inputWidth:"350", position:"" },
{ type:"input" , name:"link_sonico", label:"Link:", inputWidth:"350", position:"" },
{ type:"settings" , labelWidth:"90", labelAlign:"right", position:"label-left" }
] },
{ type:"button" , name:"save", value:"Guardar", width:"100", position:"" },
{ type:"button" , name:"new", value:"Nuevo", width:"100", position:"" }
];
var myForm = new dhtmlXForm("form_container",formStructure);
myForm.attachEvent("onButtonClick", function(id) {
if (id == "save"){
myForm.save();
}
});
var dp1 = new dataProcessor("data.php");//instatiate dataprocessor
dp1.init(myForm);//link form to dataprocessor
///////Grilla
function doOnRowSelected1(id) {
myForm.load("data.php?id="+ mygrid1.cells(id,0).getValue());
}
This is the code of data.php
<?php
require_once ('utiles.php');
require_once('./connector/form_connector.php');
$id = $_GET['id'];
$res = conectarse();
$form = new FormConnector($res);
$form->render_table("marchas","id","id,titulo,backcolor,html_mail,subject_mail,mensaje_facebook,titulo_facebook,link_facebook,mensaje_twitter,link_sonico,titulo_sonico");
?>
Thanks.