How can I open a Popup in JSF

17,275

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);
Share:
17,275
NDeveloper
Author by

NDeveloper

Ctrl+Alt+Delete...

Updated on June 04, 2022

Comments

  • NDeveloper
    NDeveloper almost 2 years

    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.

    • ClydeFrog
      ClydeFrog almost 11 years
      take a look at these tutorials
    • Alexandre Lavoie
      Alexandre Lavoie almost 11 years
      You should return false to stop p:commandButton further processing, also do the change proposed by @Markipe's answer
    • BalusC
      BalusC almost 11 years
      Just use <p:dialog> instead of all that mess?
    • kailash gaur
      kailash gaur over 8 years
      @BalusC I enough googled and everyone provided solution around the <P:dialog>. I am not able to use because of it's library support. I found that dialog attribute is supported by primefaces.org/ui library. I think this is primefaces library. Can you please guide me about this.
  • NDeveloper
    NDeveloper almost 11 years
    Hi, @Markipe: It still opens the window in different Tab. No popup opens. :(
  • Markipe
    Markipe almost 11 years
    Just try to look at this thread maybe this helps stackoverflow.com/questions/726761/…
  • Markipe
    Markipe almost 11 years
    Or if you want use jquery-ui-dialog. "window.open" has a cross-browser issue.
  • NDeveloper
    NDeveloper almost 11 years
    Hi, This works fine in Chrome, but does not work in Firefox. :( How can I do it same for FireFox?
  • Markipe
    Markipe almost 11 years
    so sad but that's a browser issue you cant do anything about that one. But for less-hassle study about this link jqueryui.com/dialog for pop-up and w3schools.com/jquery/jquery_ajax_get_post.asp for loading page to your pop-up.