Jump to content

Call procedure within JavaScript


bolossis

Recommended Posts

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?

Link to comment
Share on other sites

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', [])">
Link to comment
Share on other sites

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,

Link to comment
Share on other sites

  • 2 years later...

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

  • Like 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...