2

I need to open a Popup window on clicking a button in a xhtml page. I have written something like that:

<p:commandButton type="submit" value="Select User" onclick="showGrpMemberSearchPageCalenderLeave()"/>

and the java script is like:

function showGrpMemberSearchPageCalenderLeave()
{
    window.open('./SearchGroupMembersLeaveCalander.xhtml,resizable=no,
    toolbar=no,scrollbars=yes,height=450,width=530,top=145,left=235');

    return true;
}

But it just opens the page in the current window, no pop up window is opening.Please suggest.

Alexandre Lavoie
  • 8,711
  • 3
  • 31
  • 72
NDeveloper
  • 3,115
  • 7
  • 23
  • 34
  • take a look at these [tutorials](http://www.jquery4u.com/windows/10-jquery-popup-window-image-slider-plugins/) – ClydeFrog Jun 18 '13 at 06:15
  • You should return false to stop `p:commandButton` further processing, also do the change proposed by @Markipe's answer – Alexandre Lavoie Jun 18 '13 at 06:35
  • 1
    Just use `` instead of all that mess? – BalusC Jun 18 '13 at 13:15
  • @BalusC I enough googled and everyone provided solution around the . I am not able to use because of it's library support. I found that dialog attribute is supported by http://primefaces.org/ui library. I think this is primefaces library. Can you please guide me about this. – kailash gaur Oct 26 '15 at 17:29

1 Answers1

4

try this one instead

function showGrpMemberSearchPageCalenderLeave() { 
     window.open('./SearchGroupMembersLeaveCalander.xhtml','mywindow', 'resizable=no,toolbar=no,scrollbars=yes,height=450,width=530,top=145,left=235');
     return true;
 }

Syntax

window.open(url, windowName, specs);
Markipe
  • 616
  • 6
  • 16
  • Hi, @Markipe: It still opens the window in different Tab. No popup opens. :( – NDeveloper Jun 18 '13 at 06:32
  • Just try to look at this thread maybe this helps http://stackoverflow.com/questions/726761/javascript-open-in-a-new-window-not-tab – Markipe Jun 18 '13 at 06:35
  • Or if you want use jquery-ui-dialog. "window.open" has a cross-browser issue. – Markipe Jun 18 '13 at 06:39
  • Hi, This works fine in Chrome, but does not work in Firefox. :( How can I do it same for FireFox? – NDeveloper Jun 18 '13 at 06:42
  • so sad but that's a browser issue you cant do anything about that one. But for less-hassle study about this link http://jqueryui.com/dialog/ for pop-up and http://www.w3schools.com/jquery/jquery_ajax_get_post.asp for loading page to your pop-up. – Markipe Jun 18 '13 at 06:55