Intraweb Function Call from HTML

<< Click to Display Table of Contents >>

Navigation:  Forum >

Intraweb Function Call from HTML

Forum link

 


 

08-17-2020, 05:50 PM:

 

I was using bootstrap components to make responsive size adjustable web application but the problem I am getting is all the component calls client side java script as far as I understood. 

 

it can call Java script Function written in the same page or it redirects to another page.

 

But can I call a custom function written in C++ in my web application as I can call it within the web application.

 


 

08-18-2020, 12:17 PM:

 

If I understand correctly, you basically want to call a function in your application, written in C++, from your page (i.e. an event from a component on that page). Is that correct?

 

If that's correct there are several ways to accomplish that. I don't have a C++ Builder demo ready, but there is one written in Delphi which should be quite simple for you to understand how it works. Please have a look:

 

https://github.com/Atozed/IntraWeb/tree/...ewCallback

 


 

08-19-2020, 04:16 AM:

 

(08-18-2020, 12:17 PM)Alexandre Machado Wrote: [ -> ]If I understand correctly, you basically want to call a function in your application, written in C++, from your page (i.e. an event from a component on that page). Is that correct?

 

If that's correct there are several ways to accomplish that. I don't have a C++ Builder demo ready, but there is one written in Delphi which should be quite simple for you to understand how it works. Please have a look:

 

https://github.com/Atozed/IntraWeb/tree/...ewCallback

 

Yes sir,

 

That's correct. But I want to call it from HTML template page.

 

like calling from menu item.

 

if menu item selected [student list] i need to call loadstudentlist function. currently I am redirecting to another page and showing student list.

 


 

08-19-2020, 11:45 AM:

 

Hi, you can call from html template in your menu list, something like this:

 

Code:

 

<li><a href="#" onclick="return ajaxCall('YOUR_DELPHI_FUNCTION', 'parametermenulist=student_list');"><i class="fas fa-map-pin"></i><p>student_menu1</p></a></li>

 

 

 


 

08-20-2020, 06:47 AM:

 

(08-19-2020, 11:45 AM)Jose Nilton Pace Wrote: [ -> ]Hi, you can call from html template in your menu list, something like this:

 

Code:

 

<li><a href="#" onclick="return ajaxCall('YOUR_DELPHI_FUNCTION', 'parametermenulist=student_list');"><i class="fas fa-map-pin"></i><p>student_menu1</p></a></li>

 

Thank you sir

 

It is working for me as I wanted.

 

 

 

Thanks to both of you.

 


 

03-24-2023, 08:25 AM:

 

(08-19-2020, 11:45 AM)Jose Nilton Pace Wrote: [ -> ]Hi, you can call from html template in your menu list, something like this:

 

Code:

 

<li><a href="#" onclick="return ajaxCall('YOUR_DELPHI_FUNCTION', 'parametermenulist=student_list');"><i class="fas fa-map-pin"></i><p>student_menu1</p></a></li>

 

 

 

Ilustre Jose Nilton,

 

Estou implementado o callback mas a expressão ajaxCall não está a ser identificado. É necessário declarar no ficheiro JQuery ou no delphi?

 

A mensagem de erro no console do brownser é a seguinte: "Uncaught ReferenceError: ajaxcall is not defined"

 

Ajude-me por favor...

 


 

03-24-2023, 10:24 AM:

 

Ilustres,

 

Preciso da vossa ajuda na implementação do callback, está retornando o seguinte erro na console do brownser: "Uncaught ReferenceError: ajaxcall is not defined"

 

Por favor!!!!!!

 

No formulario HTML:

 

<script>

 

function fncExecutarAcao(){

 

ajaxcall("procEventForm", "params=p1='Param1', p2='param2'");

 

}

 

</script>

 

<div class="dropdown-menu">

 

<a class="dropdown-item" href="#">Meu Perfil</a>

 

<a class="dropdown-item" href="#">Editar Perfil</a>

 

<a class="dropdown-item" href="#">Configuração</a>

 

<a class="dropdown-item" href="#" onclick="fncExecutarAcao();">Sair</a>

 

</div>

 

No Delphi:

 

unit ufrmIndex;

 

interface

 

uses

 

Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,

 

Vcl.Controls, Vcl.Forms, Vcl.Dialogs, ufrmPadrao, IWVCLComponent,

 

IWBaseLayoutComponent, IWBaseContainerLayout, IWContainerLayout,

 

IWTemplateProcessorHTML, IWApplication, IWTypes, IWBaseComponent,

 

IWBaseHTMLComponent, IWBaseHTML40Component, IWVCLBaseControl, IWBaseControl,

 

IWBaseHTMLControl, IWControl, IWCompLabel;

 

type

 

TfrmIndex = class(TfrmPadrao)

 

procedure IWAppFormCreate(Sender: TObject);

 

private

 

{ Private declarations }

 

public

 

{ Public declarations }

 

procedure procEventForm(EventParams: TStringList);

 

end;

 

var

 

frmIndex: TfrmIndex;

 

implementation

 

{$R *.dfm}

 

uses ufrmLogin;

 

{ TfrmIndex }

 

procedure TfrmIndex.IWAppFormCreate(Sender: TObject);

 

begin

 

inherited;

 

 

 

WebApplication.RegisterCallBack('procEventForm', procEventForm);

 

end;

 

procedure TfrmIndex.procEventForm(EventParams: TStringList);

 

var

 

s1 :TStringList;

 

I, CountParam :Integer;

 

S :String;

 

begin

 

s1 := TStringList.Create;

 

CountParam := 0;

 

try

 

s1.StrictDelimiter := True;

 

s1.CommaText := EventParams.Values['params'];

 

S := s1.CommaText;

 

CountParam := TStringList(s1).Count;

 

for I := 0 to pred(CountParam) do

 

WebApplication.ShowMessage(s1.ValueFromIndex[I]);

 

finally

 

s1.Free;

 

end;

 

end;

 

end.

 


 

04-21-2023, 03:33 AM:

 

ajaxCall is case sensitive

 

ajaxCall