Hello.
I am using smartClient v10.0 for my project. I have a dynamic form which has two fields of type hidden. When we submit the form and send the values of the fields to a servlet, it sends null. When I make the type of the fields as 'text'. it sends correct value. But as per the requirement we want the fields to be hidden. I will appreciate if you can help me to resolve it.
I have attached the code snippet below:
DynamicForm used:
exportForm: isc.DynamicForm.create({
action: "mypipeline/export.xls",
canSubmit: true,
target: "_blank",
height: 1,
fields: [
{name: "titles", type: "hidden"},
{name: "data", type: "hidden"}
]
})
Method used to submit the form:
processExport: function() {
try {
var fields = this.grid.getFields();
var titles = [];
for (var j = 0; j < fields.length; j++){
titles[j] = fields[j].title;
}
var rows = [];
var data = this.grid.getData();
var i = 0;
var sourceRec = data.get(i);
while (sourceRec != null) {
var rec = [];
for (j = 0; j < fields.length; j++) {
var value = sourceRec[fields[j].name];
if (value != null && value.toSerializeableDate)
rec[j] = value.toSerializeableDate().substring(0, 10);
else
rec[j] = value;
}
rows[i] = rec;
i++;
sourceRec = data.get(i);
}
console.log("Posting " + rows.length + " rows (" + titles.length + " fields)");
this.exportForm.setValues({
titles: isc.JSON.encode(titles),
data: isc.JSON.encode(rows)
});
this.exportForm.submitForm();
}
catch (e) {
isc.warn("Error exporting data.", e);
}
isc.clearPrompt();
},
Thanks in anticipation!
Akash
I am using smartClient v10.0 for my project. I have a dynamic form which has two fields of type hidden. When we submit the form and send the values of the fields to a servlet, it sends null. When I make the type of the fields as 'text'. it sends correct value. But as per the requirement we want the fields to be hidden. I will appreciate if you can help me to resolve it.
I have attached the code snippet below:
DynamicForm used:
exportForm: isc.DynamicForm.create({
action: "mypipeline/export.xls",
canSubmit: true,
target: "_blank",
height: 1,
fields: [
{name: "titles", type: "hidden"},
{name: "data", type: "hidden"}
]
})
Method used to submit the form:
processExport: function() {
try {
var fields = this.grid.getFields();
var titles = [];
for (var j = 0; j < fields.length; j++){
titles[j] = fields[j].title;
}
var rows = [];
var data = this.grid.getData();
var i = 0;
var sourceRec = data.get(i);
while (sourceRec != null) {
var rec = [];
for (j = 0; j < fields.length; j++) {
var value = sourceRec[fields[j].name];
if (value != null && value.toSerializeableDate)
rec[j] = value.toSerializeableDate().substring(0, 10);
else
rec[j] = value;
}
rows[i] = rec;
i++;
sourceRec = data.get(i);
}
console.log("Posting " + rows.length + " rows (" + titles.length + " fields)");
this.exportForm.setValues({
titles: isc.JSON.encode(titles),
data: isc.JSON.encode(rows)
});
this.exportForm.submitForm();
}
catch (e) {
isc.warn("Error exporting data.", e);
}
isc.clearPrompt();
},
Thanks in anticipation!
Akash
Comment