bolossis Posted November 3, 2017 Share Posted November 3, 2017 Is it possible to call a procedure from java-script code inside UniUrlFrame? I have some information on a "Scheduler booking sheet" loaded in UrlFrame. I want to pass this data to a procedure and call them from a JavaScript code Example procedure MyData(ArrivalDate,RoomNo,Test:string); My existing very BAD solution is to add my information into a UniEdit, then fire up the UniEditclick event wich fires up my procedure, but its wrong! An Example of an existing function, i have add this "2 window.parent.document.... lines", then fire up then onclick event from my UniEdit. So my procedure gets called within the onclick event, buts its very BAD scheduler.attachEvent("onDblClick", function (id, e){ var ev = scheduler.getEvent(id); window.parent.document.getElementsByName('NovusPMS_Air_Res')[0].value = "My custom Information like Reservation ID, Arrival Date etc"; ///added from me window.parent.document.getElementById('O295_id').dispatchEvent( new Event("click") ); ///added from me return false; }); This works but anyone can click the UniEdit and fire up this event. (So bad solution from my side). The right solution will be if i could pass my data directly to a procedure and call them within my code scheduler.attachEvent("onDblClick", function (id, e){ var ev = scheduler.getEvent(id); callmyprocedure; ?????? return false; }); Any idea? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 3, 2017 Share Posted November 3, 2017 Hi, Sorry, maybe I don't quite understand the question, but what if you will use ajaxRequest ? Best regards, Quote Link to comment Share on other sites More sharing options...
bolossis Posted November 3, 2017 Author Share Posted November 3, 2017 i have try ajaxRequest but inside UniURLFrame it doesn't work. Is there any way to make it work inside urlFrame? <input id="testBtn" value="saa1" type="button" onclick="ajaxRequest(MainForm.UniURLFrame1, '_test', [])"> Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 3, 2017 Share Posted November 3, 2017 Hi, Can you try to use this approach ?!: 1. <input id="testBtn" value="saa1" type="button" onclick="parent.ajaxRequest(parent.MainForm.window, '_test', [])"> 2. MainForm -> OnAjaxEvent: procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName='_test' then ShowMessage('test'); end; Best regards, Quote Link to comment Share on other sites More sharing options...
JDDEV Posted September 24, 2020 Share Posted September 24, 2020 Hi, I have the same problem with your example. When i click on "TestBtn" button my MainForm doesn't receive any event !? Have you got an other solution ? Thanks Quote Link to comment Share on other sites More sharing options...
JDDEV Posted September 24, 2020 Share Posted September 24, 2020 Hi, I find a solution : I use UniURLFrame and i read a HTML file with this line : <input id="testBtn" value="saa1" type="button" onclick="top.ajaxRequest(top.MainForm., '_test', [])"> When i click on "TestBtn" the UniFormAjaxEvent procedure show me "Test" Best regards 1 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.