robinhodemorais Posted July 14, 2020 Share Posted July 14, 2020 Hello, can I get a screen to fire an ajaxevent to another screen? For example user A is on the frmProcessos screen, I want to click on a button to fire an ajaxevent on the MainForm screen or another specific screen, example frmProcessosAndamento, is there such a possibility? if so, how? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 14, 2020 Share Posted July 14, 2020 2 hours ago, robinhodemorais said: can I get a screen to fire an ajaxevent to another screen? For example user A is on the frmProcessos screen, I want to click on a button to fire an ajaxevent on the MainForm screen or another specific screen, example frmProcessosAndamento, is there such a possibility? if so, how? Hello, Please explain... Quote Link to comment Share on other sites More sharing options...
robinhodemorais Posted July 14, 2020 Author Share Posted July 14, 2020 in Unit1 I added an event without clicking the button, passing ajaxRequest or MainForm, so without MainForm's ajaxEvent event I wanted to capture this message from Unit1. Attached or demo. AjaxEvent.rar Quote Link to comment Share on other sites More sharing options...
robinhodemorais Posted July 15, 2020 Author Share Posted July 15, 2020 is there a possibility? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 15, 2020 Share Posted July 15, 2020 2 hours ago, robinhodemorais said: is there a possibility? procedure TUniForm1.UniBitBtn1Click(Sender: TObject); begin (Sender as TUniBitBtn).JSInterface.JSCode('ajaxRequest(MainForm.window, "message", ["edit='+ UniEdit1.Text +'"]);'); end; Quote Link to comment Share on other sites More sharing options...
robinhodemorais Posted July 15, 2020 Author Share Posted July 15, 2020 1 hour ago, Sherzod said: procedure TUniForm1.UniBitBtn1Click(Sender: TObject); begin (Sender as TUniBitBtn).JSInterface.JSCode('ajaxRequest(MainForm.window, "message", ["edit='+ UniEdit1.Text +'"]);'); end; perfect, just one more detail, can i apply this code in a procedure? not push the button, but a trigger procedure? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 16, 2020 Share Posted July 16, 2020 10 hours ago, robinhodemorais said: just one more detail, can i apply this code in a procedure? not push the button, but a trigger procedure? Hello, Sorry, please clarify your question. Quote Link to comment Share on other sites More sharing options...
robinhodemorais Posted July 16, 2020 Author Share Posted July 16, 2020 Oops, I'm sorry, I was forming the idea better, come on, I'm receiving information through the UniGUIServerModuleHTTPDocument and when I receive this information, my idea now is different from this ajax event in the main form, so use the same idea, so the main form doesn't have JSInterface, how to do? Quote Link to comment Share on other sites More sharing options...
robinhodemorais Posted July 16, 2020 Author Share Posted July 16, 2020 tried this way, but the error when applying JS ScriptJS: = 'ajaxRequest (MainForm.window, "message", ["edit = msg"]);'; UniSession.AddJS (ScriptJS); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 16, 2020 Share Posted July 16, 2020 19 minutes ago, robinhodemorais said: so the main form doesn't have JSInterface Self.WebForm.JSInterface Quote Link to comment Share on other sites More sharing options...
robinhodemorais Posted July 16, 2020 Author Share Posted July 16, 2020 I set up that way ... but giving error Access violation at address 007E2DE8 in module 'Project1.exe'. Read of address 00000064 procedure TUniServerModule.UniGUIServerModuleHTTPDocument ( const Document: string; const InParams: TStrings; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean); begin if ARequestInfo.URI = '/test' then begin MainForm.WebForm.JSInterface.JSCode ('ajaxRequest (MainForm.window, "message", ["edit = teste"]);'); end; end; Quote Link to comment Share on other sites More sharing options...
robinhodemorais Posted July 16, 2020 Author Share Posted July 16, 2020 what I'm trying to do now is to trigger a ServerModule event in the Main form, I made several attempts and without success, is there a possibility? I believe that will end my doubt, thank you. 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.