Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DynamicForm.submitForm() sends null value for fields which are hidden

    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

    #2
    Is it a bug or is there any way to send data to URL directly from a Dynamic form which have hidden fields?

    Comment


      #3
      Please try this with the latest patched build (see SmartClient.com/builds) and be sure to always do so in the future, as well as posting your full version (not just 10.0).

      Comment


        #4
        SmartClient Version: v10.0p_2015-09-03/LGPL Deployment (built 2015-09-03) is the version and built I'm using for the project. I cannot change the version as per the requirement of the project. But, I tried the patch SmartClient_v101p_2017-05-09_LGPL but still same error persists.
        Last edited by AkashMohapatra; 11 May 2017, 05:26.

        Comment


          #5
          Is there any way if I can make a form not visible yet able to post the details directly in an URL?

          Comment

          Working...
          X