file upload control width problem with IE7

We have a dynamic form with a field of type binary and, for some reason, the field is showing up too small in IE7 and showing up fine in Firefox. I’ve tried replicating in your feature explorer and it always renders correctly there. So, it is definitely something in our layout causing the problem. I’ve been trying to apply a cellStyle or other styling to fix the problem because I can’t figure out why it is happening. Do you have any suggestions on what could be causing this in IE7 or how I can go about debugging this issue? I see in the dev console very different html output for the two browsers but I’m having trouble making sense of it.

I’ve attached screenshots showing both browsers to see the problem.

Hello, I figured it out. We have a global setting on textItems defined as follows:

	isc.TextItem.addProperties({width:60})

So, since UploadItem is a subclass of TextItem, this was impacting the width but only in IE7 for some reason. So, by adding this, we get back to what we need in both browsers

	isc.UploadItem.addProperties({width:150})

So, if you try the following code in your feature explorer here, http://www.smartclient.com/docs/6.5.1/a/system/reference/SmartClient_Explorer.html#formLayoutTitles, you will see different behavior for FF3 vs IE7. FF3 seems to continue rendering at 150 while IE7 shrinks the field to 60 with the following code:

isc.TextItem.addProperties({width:60});



isc.DynamicForm.create({
    ID: "exampleForm",
    width: 250,
    fields: [
        {name: "username",
         title: "Username",
         type: "text",
         required: true,
         defaultValue: "bob"
        },
        {name: "email",
         title: "Email",
         required: true,
         type: "text",
         defaultValue: "bob@isomorphic.com"
        },
        {name: "password",
         title: "Password",
         required: true,
         type: "password"
        },
        {name: "password2",
         required: true,
         title: "Password again",
         type: "password", width:150
        },
{name:"attachedFile",type:"binary", width:250}
    ]
});

isc.Button.create({
    left: 300,
    title: "Swap titles",
    click: function () {
        exampleForm.setTitleOrientation(exampleForm.titleOrientation == "top" ? "left" : "top");
    }
});

Hi..

I was also facing the same situation.. I just put type:“upload” instead of type:“binary” .. and it worked.

Just check for you also.

Regards,
Jenis Modi

Thanks for the feedback. I did get it working by setting the uploadItem width property as I mentioned even though I haven’t declared my field as type upload and it just declared as type Binary.

Isomorphic: There is some funkiness going on with defining fields as “upload” vs “binary”. The docs and other forum posts seem to suggest the two are interchangeable (unless I’m mis-reading) but I get different behavior in my server-side interactions and client-side as well with the two different fields.

It looks like I am now on the track to use “binary” because when I switch to “upload”, it breaks things when trying to upload files probably based on the way I’ve written my logic server-side. However, using “binary” wasn’t letting me save a dynamic form unless there was a file attached. It throws the following error server-side:

12:42:21,625 ERROR [ATErrorHandler] Trace: java.lang.NullPointerException
	at com.isomorphic.datasource.DSRequest.parseUploadedFiles(DSRequest.java:285)
	at com.isomorphic.datasource.DSRequest.<init>(DSRequest.java:260)
	at com.isomorphic.rpc.RPCManager.parseRequest(RPCManager.java:980)
	at com.isomorphic.rpc.RPCManager.<init>(RPCManager.java:225)

I had to explicity set the encoding correctly on the form in order to submit form values without a file attchment like this. I had the impression that explicity setting the encoding on a form should no longer be necessary with 6.5 but perhaps there are some cases where we still do?

				if(assetNotesEditor.attachedFile==null){
					assetNotesEditor.encoding="normal";
				}else{
					assetNotesEditor.encoding="multipart";
				}

Just another follow-up on this. It turns out that even with setting the encoding manually to normal when there is no file to upload, I was still getting the NPE on parseUploadFiles if I upload a file on one request and then submitted the same form another time but with no file. So, I tried switching over to type:“upload” to see if I could solve the problems I was seeing earlier using type:“upload” instead of type:“binary” as opposed to fighting with problems with type:“binary”.

The problem with type:“upload” was the first file upload happened ok but the second call to form.saveData() with no file was setting dsRequest.target for some reason and that was forwarding us to a different page in the response which is obviously no good. I see some other posts on this forum about using target with hidden frames for uploads so I guess this problem may be related to fixes for those other posts.

So, I am now checking for the target attribute if there is no file attachment and removing it via the transformRequest method of Datasource and all seems to work (for now) with type:“upload”.

Here is the logic in transformRequest:

      if(dsRequest.data.attachedFile==null && dsRequest.target!=null){
    	//hack to remove target attribute causing problems with upload field type
    	//when that field type is null
    	delete dsRequest.target;  
    	isc.Log.logInfo("deleting target from dsRequest");
      }

thanks for the comment buddy . I will also have to change the things in my code too now.