AMIT Posted April 15, 2016 Posted April 15, 2016 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. Quote
Sherzod Posted April 15, 2016 Posted April 15, 2016 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. Quote
AMIT Posted April 15, 2016 Author Posted April 15, 2016 Thank you. It's work correctly. Anyway I wonder why the Params.Values change the space to +. Why do we have to use UTF8Decode and HTTPDecode function to correct this? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.