Warning when using FileItem type followed by error

I am getting a lot of those warnings in logs followed by error:
I have field “newDocument” type="binary in datasource.
In the form this field is of file type. I am doing everything according to documentation, treating it as standard field and not returning data for this field from Response.
Do you know what is causing it?

ebooth:13:30:56.859:MUP3:WARN:DocumentEditor:isc_EditNote_1282_documentSection_documentEditor:about to call saveData(), validation now returns: true
ebooth:13:30:56.859:MUP3:WARN:RPCManager:request specified explicit transport: xmlHttpRequest, but other settings (directSubmit, downloadResult, or target) mandate hiddenFrame transport, switching transport to hiddenFrame and submitting without queueing
ebooth:13:30:59.140:WARN:FileItem:isc_FileItem_1382:Cannot programatically set the value of an upload field due to security restraints
ebooth:13:30:59.484:RDQ2:WARN:Log:Error:
‘‘this.formItem.formatPickListValue’ is null or not an object’
in http://athena/cue/home.htm
at line 1472
PickListMenu.formatCellValue(_1=>“LEGAL”, _2=>Obj, _3=>0, _4=>0)
ListGrid.$315(_1=>“LEGAL”, _2=>Obj, _3=>Obj{name:subDocType}, _4=>0, _5=>0)
ListGrid.getCellValue(_1=>Obj, _2=>0, _3=>0, _4=>[GridBody ID:isc_PickListMenu_1363_body])
[o]GridBody.getCellValue(record=>Obj, rowNum=>0, colNum=>0, gridBody=>[GridBody ID:isc_PickListMenu_1363_body])
GridRenderer.$22k(_1=>Obj, _2=>0, _3=>0)
GridRenderer.getTableHTML(_1=>undef, _2=>undef, _3=>undef)
GridRenderer.getInnerHTML(undef)
“var _1=this.getTableHTML(),_2=this.$57k;_2[1]=this.getTableZIndex();_2[3]=_1;return _2.join(isc.emptyString)”
Class.invokeSuper(_1=>null, _2=>“getInnerHTML”, _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef)
Class.Super(_1=>“getInnerHTML”, _2=>Obj{length:1}, _3=>undef)
GridBody.getInnerHTML(undef)
Canvas.$px(_1=>undef)
Canvas.$rd(undef, undef, undef, undef, undef, undef, undef, undef)
** recursed on Class.invokeSuper

My datasource:

<DataSource ID="documentDS" dataURL="/athena_cue/isomorphic/IDACall/documentDS" serverType="generic"> 
<fields>
	<field name="documentId" type="sequence"  hidden="true"/>
	<field name="windowsId" type="text" hidden="true"/>
	<field name="userId" type="integer" primaryKey="true" hidden="true"/>
	<field name="objectId" type="text" hidden="true"/>
	<field name="referenceObjectId" type="text" primaryKey="true" hidden="true"/>
	<field name="noteId" type="sequence" primaryKey="true" hidden="true"/>
	<field name="claimId" type="integer" primaryKey="true" hidden="true"/>
	<field name="docType" type="text" title="Document Type" />        
	<field name="subDocType" type="text" title="Sub Document Type" />
	<field name="subject" type="text" title="Subject"/>
	<field name="contentType" type="text" title="Format"/>
	<field name="objectName" type="documentLink" title="File Name"/>
	<field name="isUpdateable" type="editableRecord" title="&nbsp;"/>
	<field name="removeDocument" type="boolean" title="&nbsp;"/>
	<field name="isLatest" type="boolean" title="&nbsp;"/>
	<field name="isAttached" type="boolean" title="&nbsp;"/>	
	<field name="newDocument" type="binary" />	
	<field name="actionType" type="text" hidden="true"/>
	<field name="indexDate" type="date" title="Index Date" hidden="true"/>
</fields>
<serverObject lookupStyle="spring" bean="DocumentDMI" />
</DataSource>

My form :

newDocumentFormDefaults : {
    _constructor: "DirtyForm",
    dataSource: "documentDS",
    width: 700, 
    height: 100,
    numCols: 4,
    backgroundColor:"#ffff99",
    colWidths: [150, 200, 150, 200],
    fields: [
		{name:"errorMessage",type:"header",textBoxStyle:"search_errorheading",visible:false,showIf:"false"},
		{name:"error",type:"header",textBoxStyle:"search_errorheading",visible:false,showIf:"false"},
		{name: "subject", width: "*", title: "Subject", required: true,
			change: function (form, item, value, oldValue) {
				form.creator.creator.setDirty();
			}
		},
    	{name:"claimId",showIf:"false"},
    	{name:"noteId",showIf:"false"},
        {name: "newDocument", title: "Browse",required:true,formItemType:"file",
			change: function (form, item, value, oldValue) {
				form.creator.creator.setDirty();
			}
		},
    	{name:"docType",type:"select",required: true,optionDataSource:"documentTypeDS",displayField:"docType",defaultValue:"Select....",autoFetchData:true,
			//Populates the Sub Document Type Dropdown depending upon the Document Type selected
			changed:function(form,item,value,oldValue) {
				Log.logDebug("Entering changed()","DocumentEditor.js$DocumentSection");
				var subDocTypeSelect=this.form.getField("subDocType");
				this.form.getField("subDocType").clearValue();
				form.creator.creator.setDirty();
				if(value=="*All*") {
					var data={
						subDocType:" "
					};
					this.form.getField("subDocType").setValueMap(data);
				} else {
					var criteria={
						docType: value
					}
					documentSubTypeDS.fetchData(criteria,this.form.getField("subDocType").getID()+".setValueMap(data)");
				}
				Log.logDebug("Exiting changed()","DocumentEditor.js$DocumentSection");
			}
		},
        {name:"subDocType",defaultValue:"Select....",required:true, type:"select",
			change: function (form, item, value, oldValue) {
				form.creator.creator.setDirty();
			}
		},
        {name: "actionType",defaultValue:"attachNewDocument",showIf:"false"}
    ],
	//When user clicks 'Enter' the document is attached to note
	itemKeyPress:function(item,keyName,characterValue) {
		if(keyName=="Enter") {
			Log.logDebug("Calling attachDocumentButtonClicked()","DocumentEditor.js$DocumentSection");
			this.creator.attachDocumentButtonClicked();
		}
	}
},

fragment of code where error happenes:

this.logWarn("about to call saveData(), validation now returns: " + this.newDocumentForm.validate());
			this.newDocumentForm.getField("errorMessage").setValue(" ");
this.newDocumentForm.saveData(this.getID()+".documentSaved(dsResponse,data,dsRequest)");

documentSaved function(provides error hadling if error happened in save):

documentSaved : function (dsResponse,data,dsRequest) {
		if(dsResponse.errors && dsResponse.errors[0] && dsResponse.errors[0].uploadError && dsResponse.errors[0].uploadError.errorMessage) {		
		this.creator.creator.showFormError("Error occured while uploading the file");
		this.closeClick();		
		return false;
	}
	if(dsResponse.errors && dsResponse.errors[0] && dsResponse.errors[0].error && dsResponse.errors[0].error.errorMessage) {	        
	        if(dsResponse.errors[0].error.errorMessage.contains("WRITE permit is required")) {
	           this.creator.creator.showFormError("Unable to attach a new document to this note as you do not have sufficient privileges in Documentum.  Please contact the Helpdesk.");
	        }
	        else
	        {
		   this.creator.creator.showFormError("Error occured while attaching document to a note");
		}
		this.closeClick();		
		return false;
	}

    // catch unspecified errors
    if (  dsResponse.status < 0 ) {
        cue.say("Unable to save document.  Please try again.");
               this.closeClick();
        return false;
    }

	cue.UIPrompts.showSavedPrompt('Document added');		
	this.closeClick();
	},

There are 2 warnings and 1 error here. The first warning:

WARN:RPCManager:request specified explicit transport: xmlHttpRequest, but other settings (directSubmit, downloadResult, or target) mandate hiddenFrame transport, switching transport to hiddenFrame and submitting without queueing
This one should be safe to ignore - it’s a result of the fact that the RPCManager defaultTransport is “xmlHTTPRequest”, but hiddenFrame transport will be required for submitting binary data to the server. (We’ll take a look at whether it makes sense to log this warning in this case for future releases).

I’m not readily reproducing the second warning:
WARN:FileItem:isc_FileItem_138 2:Cannot programatically set the value of an upload field due to security restraints
and the error:
WARN:Log:Error:‘‘this.formItem.formatPickListValue’ is null or not an object’

The warning may be safe to ignore - it’s caused by an attempt to programatically set the value of the upload item - The code you included doesn’t seem to do this anywhere - it could be a result of something in the DirtyForm class definition, or elsewhere in your app, it’s hard to be sure.

The error appears to be unrelated to the upload item. One thought on this: You’re setting up a ‘defaults’ object to define your DynamicForm instance (actually “DirtyForm” instance), and including an explicit array of fields. If you’re using this set of properties to create more than one form on the page you should be aware that Javascript will not be passing this array around by reference - in other words, each form will actually point to the same array of items which could certainly cause some strange behavior. If you get rid of this static fields definition block and instead override ‘initWidget()’ to create a new array of fields dynamically and pass them into the setFields method you may find the problem goes away.

Other than that:

  1. A sanity check: It looks like these errors are occurring on the client as a result of the call to saveData() - not as a result of a server response from that call - is that correct? You could check this by turning on info level logging on the RPCManager / RPCManagerResponse log categories, or just watching your server logs to see if the save operation is reaching the server and being processed.

  2. Can you give us the SmartClient version (available as isc.version) you’re seeing this issue on?

Ultimately the easiest way for us to proceed may be to get a standalone test case that reproduces the problem.
If you could put together a simple page containing the DataSource and the DynamicForm definition and as much application logic as necessary to run as a standalone page (and reproduce the problem on attempted save) this would greatly simplify our debugging efforts.
It appears that the error is occurring before the save request ever hits the server, so we wouldn’t need any back end logic to actually handle the save operation - just enough logic to stand up the form, call the method and see the errors as they occur. If the resulting page is too complex to post here (or contains additional files etc), please feel free to zip it up and email it to us at support@isomorphic.com

Thanks
Isomorphic Software

Thank you for your response.
I am using version 6.6
When I am actually creating form in the code I am doing it so every created form gets it’s own copy of the fields:

if (!this.newDocumentForm) {
			// Creates New Document Form
            this.newDocumentForm = this.createAutoChild("newDocumentForm", {
                fields: isc.clone(this.newDocumentFormDefaults.fields), 
               
            });
			            this.newDocumentControls = 	this.addItems([this.newDocumentForm]);
        }

I will try to create sample to reproduce the problem. Unfortunately we are logging all the errors automatically to the logs and it happenes randomly. So far I was not able to reproduce it though user interface. all I have to work with is the logs that I submited in the previous message.

Thanks,
David

Hi David
Thanks for getting back to me. I agree that cloning the array should be sufficient to avoid the issue with multiple forms pointing to the same array instance (so that’s not the problem). And the fact that you can’t readily reproduce it makes it a little tricky to resolve.

From looking at the stack trace and our code, I can see where the error is being generated, so I’ve put together a patch which should avoid actually getting the javascript error. However it seems there’s an underlying issue which would be good to resolve - it’s not clear how you’re getting into the state where this patch becomes necessary.

The patch includes some logging which will give us a little information about the state of the form item when you’re in this bad state, and may give us some clues as to what’s going on. If / when you hit this logging it would be interesting to see.
Overall, though it would still be really good to get a standalone test case so we can get to the bottom of what’s going on.

Ok - here’s the patch - let us know how you get on with it. Note that it’s set up to only work against build 6.6 - if you’re using something else (including 6.6.1 etc) it won’t have any effect - in this case send us the full reported isc.version and we can tweak the patch.

Thanks

Isomorphic Software

if (window.isc && isc.version.startsWith("6.6/")) {
if (isc.PickListMenu) {
isc.PickListMenu.addProperties({
    _ofcv:isc.PickListMenu.getPrototype().formatCellValue,
    formatCellValue : function (value,record,rowNum,colNum) {
        if (!this.formItem || !this.formItem.formatPickListValue) {
            var dataSource = this.getDataSource(),
                fieldName = this.getFieldName(colNum);
            if (dataSource) dataSource = dataSource.getID();
            
            var msg = "PATCH DEBUGGING INFO: formatCellValue on pickList for field:"+ fieldName +
                         "\n- formItem:"+ this.echo(this.formItem) +
                         "\n- drawn/visible?:" + [this.isDrawn(),this.isVisible()] +
                         (this.formItem ? ("\n- formatPLV:"+ this.formItem.formatPickListValue +
                                      "\n- destroyed:"+ this.formItem.destroyed) : "") +
                         "\n- DataSource:" + dataSource +
                         "\n- Shared?:" + [(isc.PickList.$14w == this),
                                           (dataSource && isc.PickListMenu.$51t &&
                                            isc.PickListMenu.$51t[dataSource] &&
                                            isc.PickListMenu.$51t[dataSource].contains(this))]
            if (!this.formItem) this.logWarn(msg, "formatPickListValuePatch");
            else this.logInfo(msg, "formatPickListValuePatch");
            
            return value;
        } else return this._ofcv(value,record,rowNum,colNum);
        
    }
});
}
} else if (window.isc) {
    isc.logWarn("Patch code included for SmartClient version 6.6 - you're running version:"
                + isc.version + 
                " - patch code not be applied to this application and may be removed.");
}

Sorry to be offtopic but what’s with the “6.6 version”?
I’m just curios :slight_smile: because I’ve seen just 6.0, 6.5, 6.5.1 and 7.0 beta and no 6.6 :))

David works with a company that has Enterprise Support, and for them we created an interim build with specific features that they need, and which we support them on.