MOGSY Posted February 20, 2020 Share Posted February 20, 2020 Hi How to send an Ajax request from UnimHTMLFrame back to the server. Thank you Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 20, 2020 Share Posted February 20, 2020 28 minutes ago, MOGSY said: How to send an Ajax request from UnimHTMLFrame back to the server. What is on the UnimHTMLFrame? Quote Link to comment Share on other sites More sharing options...
MOGSY Posted February 20, 2020 Author Share Posted February 20, 2020 We have a small form I pass a string to it which is displayed on the screen. When the user presses a button I want to send a response to the server side. regards Quote Link to comment Share on other sites More sharing options...
cbr Posted February 22, 2020 Share Posted February 22, 2020 Hi MOSGY a simple example: a) put in the HTMLFrame this code <script> function callServer(elmnt, event) { var HTMLFrame = Ext.getCmp("_HTMLFrame"); var params=[]; switch (elmnt.type) { case "text": params = ["id="+elmnt.id, "val="+elmnt.value, "xevent="+event ]; break; case "button": params = ["id="+elmnt.id, "val="+elmnt.value, "xevent="+event ]; break; case "checkbox": params = ["id="+elmnt.id, "val="+elmnt.value, "checked="+elmnt.checked, "xevent="+event ]; break; }; if (params.length>0) { ajaxRequest(HTMLFrame, 'callserver', params); } } </script> ... <span> <a href="#" style="text-decoration: none; color:white" onclick="callServer(this,'onclick')">3</a></span> b) in MainForm you can write the server side code in OnAjaxEvent procedure TMainForm.HTMLFrameAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); var sParam: string; begin if EventName = 'callserver' then begin sParam := Params['id'].AsString; if sParam = 'P' then begin ... end; end; end; best regards Quote Link to comment Share on other sites More sharing options...
MOGSY Posted February 23, 2020 Author Share Posted February 23, 2020 thank you Quote Link to comment Share on other sites More sharing options...
MOGSY Posted February 24, 2020 Author Share Posted February 24, 2020 Hi var HTMLFrame = Ext.getCmp("_HTMLFrame"); The value of HTMLFrame from above is undefined. How to get the refernce to HTMLFrame? Regards Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 24, 2020 Share Posted February 24, 2020 36 minutes ago, MOGSY said: var HTMLFrame = Ext.getCmp("_HTMLFrame"); The value of HTMLFrame from above is undefined. How to get the refernce to HTMLFrame? Hello, Please see this demo: \FMSoft\Framework\uniGUI\Demos\Desktop\ClientEvents-HtmlToAjax function beforeInit(sender, config) { config.id = '_HTMLFrame'; } But this example is for the desktop version, try for the mobile too ... Quote Link to comment Share on other sites More sharing options...
MOGSY Posted February 24, 2020 Author Share Posted February 24, 2020 Hi Sherzod It is not working, The value of HTMLFrame from above is undefined. regards Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 24, 2020 Share Posted February 24, 2020 HI, 9 minutes ago, MOGSY said: It is not working, The value of HTMLFrame from above is undefined. Do you want to say that this does not work for the mobile version? Quote Link to comment Share on other sites More sharing options...
MOGSY Posted February 24, 2020 Author Share Posted February 24, 2020 Yes that is correct. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 24, 2020 Share Posted February 24, 2020 21 minutes ago, MOGSY said: Yes that is correct. I will try to check it on the mobile version too... Quote Link to comment Share on other sites More sharing options...
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.