Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread form encoding method issue
Tue, May 29 2018 11:18 AMPermanent Link

Matthew Jones

I have a form that may be submitted to multiple servers, and they need different parameter encodings so my code has to change this at run time.

I have a simple THTMLForm, and for one mode I set the feURLEncoded option, set the URL which has the parameters, and away it goes. Except it doesn't - the form actually submitted is still feMultiPartFormData in the header. However, if I set the form to be URL encoded in the IDE, it works fine. But I can't have that as the default, and it should work. The library code is quite simple, so looks to be passing this on to the browser to do the work.

Anyone got any suggestions as to how I can resolve this?

controlForm.Encoding := feURLEncoded;
case controlForm.Encoding of
feMultiPartFormData: frmWelcome.Report('Encoding feMultiPartFormData');
feURLEncoded: frmWelcome.Report('Encoding feURLEncoded'); // shows okay!
feTextPlain: frmWelcome.Report('Encoding feTextPlain');
else frmWelcome.Report('Encoding unknown');
end;
controlForm.URL := szFinalURL;
controlForm.Submit;

(FWIW, this is to support 3D-secure on a web page, and the card processor needs this mode, so I cannot control that!)

--

Matthew Jones
Tue, May 29 2018 1:28 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I have a simple THTMLForm, and for one mode I set the feURLEncoded option, set the URL which has the parameters, and away it goes. Except it doesn't - the form actually submitted is still feMultiPartFormData in the header. However, if I set the form to be URL encoded in the IDE, it works fine. But I can't have that as the default, and it should work. The library code is quite simple, so looks to be passing this on to the browser to do the work. >>

It's a bug, and the hot fix is this:

WebUI unit:

function TFormElement.RequiresUpdate(AChanges: TSet): Boolean;
begin
  Result:=inherited RequiresUpdate(AChanges);
  if (not Result) then
     begin
     if AChanges.Exists(ecURLChanged) or
        AChanges.Exists(ecEncodingChanged) or <<< Add
        AChanges.Exists(ecMethodChanged) or <<< Add
        AChanges.Exists(ecTargetChanged) then
        Result:=True;
     end;
end;

Tim Young
Elevate Software
www.elevatesoft.com
Image