Announcement

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

    DynamicForm.setFields asynchronous?

    I'm using SmartClient 8.0, client libraries only.

    Have a situation where I am using a DynamicForm to submit a dynamic field list to a non-SmartClient server process (standard HTML form submission) through a hidden iframe. This process is triggered by clicking a button. The problem is that the first time the button is pressed, nothing happens. The second time the button is pressed, the desired action from the first press occurs- and each subsequent button action triggers the *previous* action that should have occurred.

    In the code below it appears that DynamicForm.submit is occurring before the DynamicForm.setFields process is complete. Is there any way to make these steps occur in a synchronous manner? Another method of setting the fields/values prior to submitting the form?

    iframe and DynamicForm code:
    Code:
            var iframeCanvas = document.getElementById('exportIframe');
        	
            if(!iframeCanvas) {
              isc.Canvas.create({
                ID: "exportIframe",
                contents: "<iframe name=\"exportIframe\"></iframe>",
                autoDraw: true,
                visibility: "hidden"
              });
            }
            
            var exportForm = isc.DynamicForm.create({
            	autoDraw: true,
            	canSubmit: true,
                    target: "exportIframe",
                    fields: []
            });
    Button action:
    Code:
    exportButtonAction: function(){
            var grid = this.listGrid;
            var actionURL = grid.dataSource.dataURL;
            var data = isc.addProperties({}, grid.data.getCriteria(), {OPERATION_TYPE: "fetch", OUTPUT_FORMAT: "CSV", SESSION_ID: isc.applicationWindow.loginData.session_id, START: 0, END: 99999});
            var fields = new Array();;
            
            for(key in data){
            	fields.push({name: key, value: data[key], type: "hidden"});
            }
            
            exportForm.setAction(actionURL);
            exportForm.setFields(fields);
            exportForm.submit();
        },
Working...
X