2 Replies Latest reply on Oct 1, 2007 7:37 AM by Marcelo Krebber

    How to open a pop window

    kavi arasu Newbie

      Hi i want to open a pop up window , the parent window is a xhtml page .im using rich face 3.1 and jboss-seam-2.0.0.CR1. In Red hat developer studio
      how to open pop up window as we open using java script in html.
      in my pop window i want to show a xhtml file
      thank u

        • 2. Re: How to open a pop window
          Marcelo Krebber Newbie

          IMHO the richfaces modalpanel implementation is still very unstable and not ready yet for production use. so, if you dont really need it, avoid modal panels at all (of course we need them in my project, and therefore are forced to use them ;-) ..)

          anyway, to open a panel window using js, write your openwindow() function and save it in a separate .js file, then import it using <a4j:import ..> .other combinations may not work. then check the doc for <a4j:..> tags which support things like oncomplete="openwindow()", onsubmit="..", etc, depending on what you want to do.

          mysample.js (notice the mywindow.jsf for .xhtml files):

          function openwindow() {
           popUpWin = window.open("./mywindow.jsf", "mypopUpWin", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width=400,height=50");

          and this would be the .xhtml that fires the openwindow():

          <?xml version="1.0" encoding="iso-8859-1"?>
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml"
          <f:view contentType="text/html">
           <ui:composition template="template.xhtml">
           <ui:define name="main-content">
           <a4j:loadScript src="./mysample.js"/>
           .. your code..
          <h:commandLink immediate="true" image="Adobe.gif" style="cursor:pointer" actionListener="#{some.listener}" onclick="javascript:openwindow()">
           <h:graphicImage value="./Images/Adobe.gif" />
           <f:attribute name="param1" value="#{somebean.param1}" />

          the above works for richfaces and regular jsf tags. you can also fire richfaces scripts using <a4j:jsScript..>