Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread form posts truncating data - firefox
Mon, Nov 3 2014 6:46 PMPermanent Link

Stephen Barker

This has taken a while to get this far. Any tips on how to debug further would be great.

I have a form in EWB with edit controls associated with TDataset fields by name. A Save button does a SubmitForm like so:

procedure TfrmProductEdit.btnSaveClick(Sender: TObject);
var
 s, ls : string;
begin

 ls := SiteParams.LineSeparator;
 SiteParams.LineSeparator := '&';
 s := trim(SiteParams.Text);
 SiteParams.LineSeparator := ls;
 if frmUserHome.Prod.State = dsUpdate then
   pnlProduct.FormURL := SiteURL + '?' + s + '&action=produpdate&ID='+frmUserHome.Prod.Columns['ID'].asString;
 else if frmUserHome.Prod.State = dsInsert then
   pnlProduct.FormURL := SiteURL + '?' + s + '&action=prodinsert&ID='+frmUserHome.Prod.Columns['ID'].asString+'&ProdGroupID=2';
 else
   exit;
 pnlProduct.FormOutputPage := pageOutput;
 pnlProduct.FormMethod := fmPost;
 //pnlProduct.FormEncoding := 'application/x-www-form-urlencoded';
 pnlProduct.FormEncoding := 'multipart/form-data';
 pnlProduct.SubmitForm;
 frmUserHome.Prod.Save;

A couple of the fields are memos and their values are getting truncated. This only happens in Firefox. IE and Chrome seem to work fine, so my server back end (ISAPI) appears to be processing the multipart data ok.

e.g. using IE browser, I type in the memo field named Description: "Purchase a set of 5 lovely little black shopping bags". Looking at my ISAPI server debug logs, I see:
04/11/14 12:29:50,Multipart field header: Content-Disposition: form-data; name="Description"
04/11/14 12:29:50,Multipart field value: Description=Purchase a set of 5 lovely little black shopping bags

using FF browser, I type in the memo field named Description: "Purchase a set of 5 plain black recyclable shopping bags". Looking at the ISAPI logs, I see:
04/11/14 12:36:33,Multipart field header: Content-Disposition: form-data; name="Description"
04/11/14 12:36:33,Multipart field value: Description=Purchase a set of 5

It has truncated the Description after the word "5" - a fairly random place, but it does always seem to be after the first few words.

I have just upgraded EWB to 1.04 in the hope it was something there, but no.

Firefox has just updated to version 33.02, but the problem is still there also.

What's the best way to intercept the form data to see at what point in the process it is getting truncated?

thanks,
Steve
Mon, Nov 3 2014 9:32 PMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 11/3/2014 6:46 PM, Stephen Barker wrote:
> What's the best way to intercept the form data to see at what point in the process it is getting truncated?

I'd start with the debugging facilities in the browser itself - they are
very good.

For FF  its the toggle developer tools (Ctrl+Shift+I) and then look in
the Network section as it will show your request going out with params
and headers etc with all the detail. Other browsers are very similar also.

If this does not pinpoint/solve your problem then next step would be to
intercept the traffic with something like Fiddler
(http://www.telerik.com/fiddler) to see what really goes oin between
browser and server.

Wireshark (https://www.wireshark.org/) is great as well but for simple
http intercept other options above are easier.

Raul



Tue, Nov 4 2014 4:24 AMPermanent Link

Matthew Jones

Raul wrote:

> I'd start with the debugging facilities in the browser itself - they
> are very good.

I agree, and also I'd start using a few basic debug techniques, like
making the text "constant" (hard coded) and start with a string of
"12345678901234567890..." and see if there is any fixed position that
it truncates at. Look out also for things like wrapping where a
carriage return got added and would look invisible, but might cause the
text to wrap and be mis-interpreted as the next line of the header.


--

Matthew Jones
Wed, Nov 5 2014 12:32 PMPermanent Link

Stephen Barker

Thanks guys. The initial problem has now been fixed and it was at my server end, which was incorrectly handling end of lines for memos instead of looping until the next boundary marker. Some ancient old code that I had inherited from somewhere, which worked for previous sites with only single line text fields and file uploads done this way.

But this has highlighted another problem - with Firefox. I have a TMemo field 300 px wide, using font size 9 containing the following text which naturally wraps on the first line after the word eleven:

one two three four five six seven eight nine ten eleven
twelve thirteen fourteen

When this is submitted to the server using Internet Explorer or Chrome it stays intact and is (now) parsed correctly and saved to the database field correctly with a crlf after the word eleven. However, Firefox first does some extra wrapping somehow and it is sent like this:

one two three four
five six seven eight
nine ten eleven
twelve thirteen
fourteen

Any ideas?

Also this app will eventually need to handle more than plain text product descriptions. What methods do others use for content management using EWB?

regards,
Steve
Thu, Nov 6 2014 6:30 AMPermanent Link

Matthew Jones

Stephen Barker wrote:

> Any ideas?

The key here is the browser, and the EWB source code. But usually the
browser. The source will tell you what is happening, and which element
is being read from the browser DOM. Then you go to Google and find out
the limitations and reasoning for Javascript and that browser feature.
I found that once you gain a good understanding of what is happening,
you can either do it the better way, or get a reproducable case which
Tim can incorporate into an update (you can of course fix the framework
first for testing). But the browser is where the action happens, so
that's where I'd look.


> Also this app will eventually need to handle more than plain text
> product descriptions. What methods do others use for content
> management using EWB?

Me, I currently allow HTML tags in my web shop but I trust myself not
to get it wrong. Hopefully the version 2 update will allow us to use
the WYSIWYG editors as components.


--

Matthew Jones
Image