Jump to content

How to write Code to Open new browser windows in UniButton Onclick event


AMIT
 Share

Recommended Posts

Hello !!!

 

The OnClick event of Buttons and other compoment refers to process in the server. For the clients process you have to use ClientEvents to do that.

 

ClientEvents - ExtEvents - Onclick:

 

function Onclick(sender)
 {
  window.open('url');
 }

 

 

I use it for Buttons and Labels too and works.

Link to comment
Share on other sites

Hello !!!

 

The OnClick event of Buttons and other compoment refers to process in the server. For the clients process you have to use ClientEvents to do that.

 

ClientEvents - ExtEvents - Onclick:

 

function Onclick(sender)
 {
  window.open('url');
 }

 

 

I use it for Buttons and Labels too and works.

 

 

Thank you for your reply. I wonder the 'url' must be predefined, isn't it? Is it possible to do something on the server in the onclick event such as dynamic creating pdf file and store it on the server. Then create the clientevent and replace 'url' to point to the location that we just create the pdf file. My purpose is just want to have the onclick button to work as the sequence like follow.

1. Generate the PDF

2. Send the generated PDF to the client by open the new window at the client side

Link to comment
Share on other sites

  • 9 months later...
  • 2 years later...

Hi,

I coming up with the same problem. I have a Form with a button on it.  On OnClick Event of the button, i wrote something like:

Procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniSession.AddJS('window.open("http://www.plotjet.ch/exp/exp.dll?SessionID="' + SessionID + ',"_blank","");');
end;

The problem is, that on each browser i try open a new browser window, the popup blocker occurs. Internet says, that is ok because i call the window.open in a answer of a ajax call. I this case, popup blocker will occur.

So for test i write that in the ExtEvents Ext.button.Button.click event:

function click(sender, e, eOpts)
{
   window.open("http://www.plotjet.ch/exp/exp.dll","_blank","");
}

That works well, no popup blocker comes up. But i have to do lot more work before i can call window.open. I have to ask a webservice for a sessionID and have to give this SessionID somehow to the ExtEvent Click function.

 

What would be the way to do that?

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.

 Share

×
×
  • Create New...