Jump to content

call self.Name from javascript event


Mohammed Nasman

Recommended Posts

Hello,

 

I have this event on ExtEvents

 

function click(sender, e, eOpts)
{
  MyForm.window.showMask();
  ajaxRequest(MyForm.window, 'newemail',[]);
}

 

due to creating multiple forms on runtime, the MyForm got multiple names such as Myform, MyForm_1, which lead to error on JS on running the application.

 

On delphi code I can give self.name + '.window.hidemask();), but how can I call self.name from javascript code?

Link to comment
Share on other sites

Maybe you need to use like this ?!:

procedure TMainForm.UniFormReady(Sender: TObject);
begin
  with UniToolButton1.JSInterface do
    JSAddListener('click', JSFunction('me', 'var frmWin=' + Self.Name + '.window; frmWin.showMask(); ajaxRequest(frmWin, "newemail", [])'));
end;
Link to comment
Share on other sites

Thanks Delphi Developer,

 

  I thought about similar way, but I wanted to find a better an easier way, because i have many of the TuniToolButton, and this require a lot of work :-/,so I asked looking for more easier and straightforward way.

 

Is there any property similar to

 

Self.name

 

from JS?

 

Link to comment
Share on other sites

  • Administrators

Hello,

 

I have this event on ExtEvents

 

function click(sender, e, eOpts)

{

  MyForm.window.showMask();

  ajaxRequest(MyForm.window, 'newemail',[]);

}

 

due to creating multiple forms on runtime, the MyForm got multiple names such as Myform, MyForm_1, which lead to error on JS on running the application.

 

On delphi code I can give self.name + '.window.hidemask() ;), but how can I call self.name from javascript code?

 

There is no self here because you are not inside an object.

function click(sender, e, eOpts)
{
  uniVars._actFrm_.uwindow.showMask();
}

uniVars._actFrm_ returns the focused form.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...