Jump to content

callback param if there was space, it would change to + sign.


AMIT

Recommended Posts

I use the following code.

 

procedure TUniForm1.UniFormAjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'mycallback' then
  begin
    UniMainModule.FirstName := Params.Values['firstname'];
    UniMainModule.LastName := Params.Values['lastname'];
    if Params.Values['RES']='OK' then
      ModalResult:=mrOK
    else if Params.Values['RES']='CANCEL' then
      ModalResult:=mrCancel
  end;
end;

 

on HTML page if I type string into firstname input box, such as "AB CD", but the params.Values['firstname'] became "AB+CD".  

PS. I tested the demos "\Demos\Desktop\HTTP Post Callback - URLFrame - Auto Target", the same problem found.  How to fix this problem?     Please help. 

Link to comment
Share on other sites

Hi,

 

Can you try this approach?!:

 

 

 

<form name="input" action="{URL_CALLBACK}" method="POST" onsubmit="_firstname.value = encodeURIComponent(firstname.value); _lastname.value = encodeURIComponent(lastname.value); ">

<div style="padding:10;background-color:#eee;color:#0000CC">
<br/>
<br/>
<br/>
<br/>

First name: <input type="text" name="firstname" value ="Name"><br>
Last name: <input type="text" name="lastname" value="Last +Name">

<input type="hidden" name="_firstname">
<input type="hidden" name="_lastname">

<br/>
<br/>

<input type="submit" value="Submit">

<a href="{CANCEL_URL}">
  <input type="button" value="Cancel">
</a>
<br/>
<br/>
<br/>
<br/>

</div >
</form>
uses ... HTTPApp;
procedure TUniForm1.UniFormAjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'mycallback' then
  begin
    UniMainModule.FirstName := UTF8Decode(HTTPDecode(Params.Values['_firstname']));
    UniMainModule.LastName := UTF8Decode(HTTPDecode(Params.Values['_lastname']));
    if Params.Values['RES']='OK' then
      ModalResult:=mrOK
    else if Params.Values['RES']='CANCEL' then
      ModalResult:=mrCancel
  end;
end;

 

 

 

Best regards.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...