JavaScript Popup Window

Hi, has anyone done an example where you are at a page, say Page1.jsp that has a text box and a button, when you click on the button a javascript popup window must open(Page2.jsp). Page2.jsp has a text box and a button. The user will enter a value in the text box and when they click the button it must close the popup window and populate the text box on Page1.jsp with the value entered on Page2.jsp.
Is this possible in JSF, I have tried but it doesn't work. On the popup windoow botton I have javascript code that saves the value in the session, submits the parent page and then closes the popup window.
On the parent page init, I look for the value saved in the session var and set the textbox's text to it. When I read the value of the text box, it is right but on the screen the value does not show up at all,
Does anyone have any idea, I can't seem to understand at all what could be wrong here.

Hi,
You can use this code:
1. in the parent form you have a button and a text field named "textCallClass".
2. in the popup window you have listbox and a button.
When the button on the popup window is clicked, the selected list item is returned.
In you popup window, button on_click :
                    <script>
                        function handleOK() {
                            var myform      = document.forms[0];
                            var listControl = myform['form1:listboxID'];
                            var openerField = window.opener.document.getElementById("form1:textCallClass");
                            if (listControl.selectedIndex == -1) {
                                alert ("Please select an item from the list !");
                                return false;
                            else {
                                openerField.value = listControl.options[listControl.selectedIndex].value;
                                window.close();
                    </script>In the parent form, button on_click:
                        function handleCallClassPopup() {
                            window.open("CallClassLookup.jsp", "Lookup", "width=250,height=300");
                        }A better way is to use the SessionBean to store and retrieve the data.
Catalin Florean.

Similar Messages

  • Syntax Error In Javascript Popup Window

    I'm wondering if anybody can help me out here with a curious bit of code. I'm using GoLive 9 to generate Javascript popup windows. They seem to work fine, but when I check the syntax I get these errors:
    Line 22 Unexpected PCDATA
    Line 24 The Corresponding start tag is missing
    Specifically, it references this code:
    </script>
    //-->
    </script>
    But every time I try to delete or modify those lines I lose the link to my css file and can't link it back. Does anybody out there with a whole lot more brains than me have a solution? Remember, I'm stupid, so if you have a fix I'd appreciate it being explained as simply as possible. Thanks. BTW here's the entire code for the Javascript popup page below:
    <!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">
    <head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta name="generator" content="Adobe GoLive" />
    <title>1408</title>
    <script type="text/javascript"><!--
    <script type="text/javascript">
    //Global var to store a reference to the opened window
    var openedWindow;
    function openWindow()
    openedWindow = window.open('moreinfo.htm');
    function closeOpenedWindow()
    openedWindow.close();
    </script>
    //-->
    </script>
    <link href="../../../BAD/michaelthibault.com/css/agl-styles.css" rel="stylesheet" type="text/css" media="all" />
    <link href="../../../BAD/michaelthibault.com/css/java.css" rel="stylesheet" type="text/css" media="all" />
    <style type="text/css" media="all"><!--
    a:link { color: #838383; }
    a:active { color: #838383; }
    .dsR1 /*agl rulekind: base;*/ { width: 480px; height: 260px; }
    #media { position: absolute; top: 50px; left: 50px; width: 480px; height: 260px; z-index: 1; }
    #pause { position: absolute; top: 320px; left: 50px; width: 180px; height: 15px; z-index: 2; }
    #close_a { position: absolute; z-index: 3; top: 336px; left: 50px; width: 180px; height: 19px; }
    --></style>
    </head>
    <body>
    <div id="media">
    <object class="dsR1" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="204" width="480" align="left">
    <param name="enablejavascript" value="true" />
    <param name="bgcolor" value="#1a1a1a" />
    <param name="src" value="../../media/01_trailers/1408_tlr1r_h.480.mov" />
    <param name="autoplay" value="true" />
    <param name="controller" value="false" />
    <embed align="left" height="204" pluginspage="http://www.apple.com/quicktime/download/" src="../../media/01_trailers/1408_tlr1r_h.480.mov" type="video/quicktime" width="480" controller="false" autoplay="true" bgcolor="#1a1a1a" enablejavascript="true"></embed>
    </object></div>
    <div id="pause">double click in center to pause</div>
    <div id="close_a">
    <a href="javascript:self.close();">close window</a></div>
    <p></p>
    </body>
    </html>

    You have a script tag nested inside another script tag. Try changing this:
    < script type="text/javascript">< !--
    < script type="text/javascript">
    //Global var to store a reference to the opened window
    var openedWindow;
    function openWindow()
    openedWindow = window.open('moreinfo.htm');
    function closeOpenedWindow()
    openedWindow.close();
    < /script>
    //-->
    < /script>
    ...to this...
    < script type="text/javascript">< !--
    //Global var to store a reference to the opened window
    var openedWindow;
    function openWindow()
    openedWindow = window.open('moreinfo.htm');
    function closeOpenedWindow()
    openedWindow.close();
    //-->
    < /script>

  • Retaining BSP page chages with Javascript popup window

    Hi Experts
    We are using a customized BSP application for our performance
    Management. To propmt users for saving their appraisal documents
    before a session timeout,we used an Javascript popup message(alert
    window). This window doesnot affect the BSP page in any way.(code
    provided below)
    Per changed requirement,we now have to retain the BSP page values once
    the user clicks 'OK' on this javascript popup window. I used the page
    refresh option with script. But this is erasing the earlier values.
    Can anyone tell me,how i can holdback the BSP page values after the
    user action on the popup window. If a piece of code is provided,it
    would be greatly appreciated.
    Thanks in Advance
    Alan
    Existing code for timeout popup
    javascript code
    function remind (){
    var msg = "Your Session will expire in the next 10 minutes. Please
    save your data.";
    alert the msg(using alert box)
    <%
    data: v_rem type string.
    DATA: port TYPE STRING.
    data: l_timer type string.
    port = request->get_header_field(
    if_http_header_fields_sap=>server_port ).
    DATA: services TYPE TABLE OF ICM_SINFO.
    CALL FUNCTION 'ICM_GET_INFO' TABLES SERVLIST = services.
    FIELD-SYMBOLS: <service> TYPE ICM_SINFO.
    DATA: wait TYPE STRING.
    READ TABLE services ASSIGNING <service> WITH KEY service = port.
    wait = <service>-KEEPALIVE - 10.
    CONDENSE wait.
    ****Start Changes: Timeout
    **l_timer = wait * 60 * 1000.
    l_timer = 1 * 60 * 1000.
    ****End Changes
    concatenate `'remind(` wait `)',` l_timer into v_rem.
    %>
    <htmlb:content design = "DESIGN2002+DESIGN2003"
    sessionManagement = "TRUE"
    controlRendering = "SAP">
    <htmlb:page title = "<%= otr(ZPMDGL/TITLE_DOCUMENT) %>"
    disableBackspaceNavigation = "TRUE" onLoad pass v_rem as a parameter to setTimeout

    duplicate post locked.
    Raja

  • Retaining BSP Page values with Javascript popup window

    Hi Experts
    We are using a customized BSP application for our performance
    Management. To propmt users for saving their appraisal documents
    before a session timeout,we used an Javascript popup message(alert
    window). This window doesnot affect the BSP page in any way.(code
    provided below)
    Per changed requirement,we now have to retain the BSP page values once
    the user clicks 'OK' on this javascript popup window. I used the page
    refresh option with script. But this is erasing the earlier values.
    Can anyone tell me,how i can holdback the BSP page values after the
    user action on the popup window. If a piece of code is provided,it
    would be greatly appreciated.
    Thanks in Advance
    Alan
    Existing code for timeout popup
    javascript code
    function remind (){
    var msg = "Your Session will expire in the next 10 minutes. Please
    save your data.";
    alert the msg(using alert box)
    <%
    data: v_rem type string.
    DATA: port TYPE STRING.
    data: l_timer type string.
    port = request->get_header_field(
    if_http_header_fields_sap=>server_port ).
    DATA: services TYPE TABLE OF ICM_SINFO.
    CALL FUNCTION 'ICM_GET_INFO' TABLES SERVLIST = services.
    FIELD-SYMBOLS: <service> TYPE ICM_SINFO.
    DATA: wait TYPE STRING.
    READ TABLE services ASSIGNING <service> WITH KEY service = port.
    wait = <service>-KEEPALIVE - 10.
    CONDENSE wait.
    ****Start Changes: Timeout
    **l_timer = wait * 60 * 1000.
    l_timer = 1 * 60 * 1000.
    ****End Changes
    concatenate `'remind(` wait `)',` l_timer into v_rem.
    %>
    <htmlb:content design            = "DESIGN2002+DESIGN2003"
                   sessionManagement = "TRUE"
                   controlRendering = "SAP">
    <htmlb:page title = "<%= otr(ZPMDGL/TITLE_DOCUMENT) %>"
                  disableBackspaceNavigation = "TRUE" onLoad pass v_rem as a  parameter to setTimeout
    Edited by: Bala Subramanyam Duvvuri on Apr 8, 2008 6:32 AM
    Edited by: Bala Subramanyam Duvvuri on Apr 8, 2008 6:34 AM
    Edited by: Bala Subramanyam Duvvuri on Apr 8, 2008 6:35 AM
    Edited by: Bala Subramanyam Duvvuri on Apr 8, 2008 6:36 AM
    Edited by: Bala Subramanyam Duvvuri on Apr 8, 2008 6:36 AM
    Edited by: Bala Subramanyam Duvvuri on Apr 8, 2008 6:37 AM
    Edited by: Bala Subramanyam Duvvuri on Apr 8, 2008 6:38 AM
    Edited by: Bala Subramanyam Duvvuri on Apr 8, 2008 6:39 AM
    Edited by: Bala Subramanyam Duvvuri on Apr 8, 2008 6:40 AM
    Edited by: Bala Subramanyam Duvvuri on Apr 8, 2008 6:40 AM
    Edited by: Bala Subramanyam Duvvuri on Apr 8, 2008 6:44 AM
    Edited by: Bala Subramanyam Duvvuri on Apr 8, 2008 6:46 AM

    If the BSP page is refrehed, all the user input it sent back to the server. If you don't do anything special, the input is lost and not sent back to the client again. You can go to your controller class' DO_HANDLE_DATA to read the user input, and store it in the controller class to send it back to the client.
    If you don't use controller classes, the equivalent would be onInputProcessing. A more advanced alternative would be to use MVC model binding, which would do most of the stuff automatically for you.

  • Javascript popup window for updatable report

    We have an updatable report and would like to have a pop-up window on one of the fields. What parameters do we pass to the pop-up so it can return the selected value to the correct row and column in the would report? What is the code in the pop-up to set the correct row/column in the updatable report?
    We are familiar with the process for form elements, but not for updatable reports.

    Hello,
    YOu just have to save the current working form field as a variable. So the popup javascript would look something like this.
    var gReturnElement;
    function customPopUp(pThis){
    gReturnElement = html_CascadeUpTill(pThis,'TD').getElementsByTagName('INPUT')[0];
    /*popup code here*/
    Then from the popup window you would use something like
    function customSetValue(pText){
    window.opener.gReturnElement.value = pText
    window.close();
    Is there a specifc reason you can't use the built in ones? It would be much easier for you to mantain compared to custom code.
    Carl
    Message was edited by:
    Carl Backstrom

  • Javascript - popup window - diplay an jpg only.

    How do take the Javascript belowr to display popup window to display an jpg only.
    The below javascript was design to work wit a URL - Would like to change it to return a ipg image only..
    ========================
    script type="text/javascript">
    function myPopupURL(url)
    w = open(url,"winLov","Scrollbars=1,left=0,top=0,resizable=1,left=0,top=0,width=500,height=200");
    if (w.opener == null) w.opener = self;
    w.focus();
    </script>
    OTN
    Message was edited by:
    Motor_City

    I'm not so hot on JavaScript myself, maybe you want to take that question into the Oracle Application Express (APEX) forum.
    C.

  • GetURL - javascript - popup window

    Hi!
    I need to get a button to open a new, fixed-size, pop-up
    window.
    This is what I used:
    on (release) {
    getURL("javascript:window.open('ponuda_tjedna.html','Ponuda
    tjedna','width=350,height=250')");
    It works just fine, opens a new window etc. but the main
    window where the button is (where the site is) goes blank, white..
    and in the upper lef corner it says: [object Window]. If I click
    BACK, it restarts the entire site.
    What can I do to keep the main window where it is?
    I've also tried writing a function in javascript directly
    into the <head> tag of index.html and call the function from
    within Flash, using getURL. That did open a new window and the main
    site didn't go blank, but in IE nothing happened.
    Thanks,
    Igor

    > on (release) {
    >
    getURL("javascript:window.open('ponuda_tjedna.html','Ponuda
    > tjedna','width=350,height=250')");
    > }
    >
    > It works just fine, open a new window etc. but the main
    window where the
    > button is (where the site is) goes blank, white.. and in
    the upper lef corner
    > it says: [object Window]. If I click BACK, it restarts
    the entire site.
    You need void(0) with window.open because it returns stuff
    and if you don't void
    the request it will do exactly what it does to you. Not the
    case if you are using
    NewWindow function. Anyway, try this instead:
    getURL("javascript:n_name=window.open('ponuda_tjedna.html','Ponuda_tjedna','width=350,heig ht=250');void(0);");
    Best Regards
    Urami
    !!!!!!! Merry Christmas !!!!!!!
    Happy New Year
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • Javascript popup in dynamic report

    Hello,
    I want to be able to use Javascript popup window from a dynamic report in Apex 4.0. Is there anything built-in to help me out? Or should I use my own javascript function in the header and call it?
    My idea would be that one column would have a icon with a link that calls a javascript function to popup a window.
    Any suggestions?
    Thanks all
    Btw, what is the markup for scripts, again?

    Try:
    javascript:popupUR

  • CS3.....using actionscript 2.0.....how do i make a popup window that actually works?

    Iv'e been trying all types of code and am pulling my hair
    out......how do i go about making a javascript popup window that
    works in safari, as well as all the other browsers? Im getting this
    error when i try to use safari:
    Safari doesn’t allow JavaScript to be used in this way.
    I just want a simple javascript popup window thats not going
    to give me any type of problems...please. I have a button on my
    stage called StartSearch.
    What code do i put in the actionscript? where do i place the
    actionscript? What code and where do i place the code in the html
    doc where the flash is embedded? Please help

    ACTIONSCRIPT:
    on (release) {
    getURL("javascript:openNewWindow('
    myMovie.swf','thewin','height=400,width=400,toolbar=no,scrollbars=yes')
    HTML:
    <html xmlns="
    http://www.w3.org/1999/xhtml"
    xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=ISO-8859-1" />
    <title>--* Home Solutions Today*--</title>
    <SCRIPT LANGUAGE=JavaScript>
    function openNewWindow(URLtoOpen, windowName, windowFeatures)
    newWindow=window.open(URLtoOpen, windowName,
    windowFeatures);
    </SCRIPT>
    <script src="AC_RunActiveContent.js"
    language="javascript"></script>
    <link href="HSTPageLayout.css" rel="stylesheet"
    type="text/css">
    <style type="text/css">
    <!--
    body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-image: url(Stuff.jpg);
    background-repeat: repeat-x;
    background-color: #FFFFFF;
    -->
    </style>
    </head>
    <body>
    <div class="Container">
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <!-- saved from url=(0013)about:internet -->
    <script language="javascript">
    if (AC_FL_RunContent == 0) {
    alert("This page requires AC_RunActiveContent.js.");
    } else {
    AC_FL_RunContent( 'codebase','
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0','widt h','700','height','850','id','Header-','align','middle','src','Header-','quality','high',' bgcolor','#336699','name','Header-','allowscriptaccess','sameDomain','allowfullscreen','fa lse','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','Header-'
    ); //end AC code
    </script>
    <noscript>
    <object
    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
    width="700" height="850" id="Header-" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="allowFullScreen" value="false" />
    <param name="movie" value="Header-.swf" /><param
    name="quality" value="high" /><param name="bgcolor"
    value="#336699" /> <embed src="Header-.swf" quality="high"
    bgcolor="#336699" width="700" height="850" name="Header-"
    align="middle" allowScriptAccess="sameDomain"
    allowFullScreen="false" type="application/x-shockwave-flash"
    pluginspage="
    http://www.macromedia.com/go/getflashplayer"
    />
    </object>
    </noscript>
    </div>
    </body>
    </html>

  • Javascript Popup causing flash problems

    Hi
    I have a popup window that shows up over flash, and when I
    close it the flash objects gets all weird. It stops drawing, and
    does not work properly. If I remove the javascript popup window
    from the DOM entirely everything is fine. Can someone point me to
    what I am doing wrong.
    I'm using the YUI libraries, and specifically the Dialog
    widget.
    Thanks
    A.J.

    i use this to open a new popup window
    on (release) { getURL("javascript:window.open('
    http://www.domain.com','Wname','width=950,height=600,top=20,left=20,toolbar=false,scrollba rs=yes,resizable=false,menubar=false,status=false');
    void(0);");

  • I want to insert thumbnails in my page that are links to videos in popup windows

    I can do this by a hyperlink but getting a thumbnail from the video and making it a link I am struggling with. I could sort the thumbnail out as an image, but it is the link i don't know how to do. I can't seem to get hotspots involved with the js link as in:
    <script type="text/javascript">
            // Popup window code
            function newPopup2(url) {
            popupWindow = window.open(
            url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolb ar=no,menubar=no,location=no,directories=no,status=yes')
            </script> <a href=
            "JavaScript:newPopup2('pop.htm');">Link text</a>
    This works like a charm, but I can't swap the "link text" for an thumbnail and hotspot or however it is done.
    Help would be great.

    Create a Pop-Up window in DW with the Behaviors Panel.  See link for details.
    http://alt-web.blogspot.com/2012/03/create-pop-up-window-in-dreamweaver.html
    You shouldn't need an image map for this.  A single thumbnail image (or text) can be linked to a pop-up page.
    Nancy O.

  • Resizing popup windows

    In the previous version of Safari, I could resize javascript popup windows even if they were scripted as non-resizable. In the new version I can't. Since non-resizable windows are the tool of the devil, I'm trying to find a way to disable that particular feature without disabling javascript altogether. Is there a way to do that?

    ra5ul wrote:
    edit: in the meantime, you can still resize those windows through either javascript or applescript.
    I have no idea how to do that For now I just look up the popup's url in the source and open the page manually.

  • Javascript popup

    Hi everybody,
    I've programmed a Javascript popup (window.open ... window.document.write).
    This does not work in the EP running on Internet Explorer 6.0 SP 1 (no problems in my PDK).
    In the EP this script only open the new window, but without contents.
    all help would be appreciated ,
    Thanks in advance,
    David Reifs

    Relaxing the domain in the popup allows the main and popup windows to 'talk' to each other, but the code shown in a previous post (win1.document.write('test')) cannot be used to relax the domain since the main window cannot write to the popup until it's domain has been relaxed.
    One solution (based on the Portal's Date Picker popup) is to:
    1. Set a Javascript variable in the main window to the desired HTML
    2. Open the popup with the URL of a HTML page that relaxes the domain then writes the HTML from the variable in the main window.
    For example:
    1. Create a static HTML page called 'empty.html' to be displayed in the popup:
    <html>
    <head>
    <script language="JavaScript">
      if (window.document.domain == window.location.hostname) {
        if (document.domain.indexOf('.') != -1) {
          document.domain = document.domain.substring(document.domain.indexOf('.')+1);
      document.write(window.opener.myHtml);     
      this.focus();     
    </script>
    </head>
    <body>
    </body>
    </html>
    2. Use code like the following to create a URL to this static HTML page:
    IResource htm = request.getResource(IResource.STATIC_PAGE, "htm/empty.htm");
    String emptyUrl = htm.getResourceInformation().getURL(request);
    3. Use code like the following Javascript to open the popup, and set the HTML to be displayed in the popup:
    var myHtml = "";
    function openPopup(title, emptyUrl, theHtml, windowName) {
      myHtml = theHtml;
      var atts = 'top=0,left=0,height=200,width=200,resizable=yes,menubar=yes,scrollbars=yes,status=yes';
      var myApp = window.open(emptyUrl, windowName, atts);
      if (myApp) {
        myApp.focus();
      else {
        alert('You may have unrequested popup blocking on.');
    4. Then use code like the following to create the button that displays the popup:
    <span id='myPopupButton' class='sapBtnStd' title='Click to open popup'
    onClick="openPopup(
       'My Pop Title',
       '<%= emptyUrl %>',
       '<h1>Hello World</h1><b>It's great to be alive.</b>',
       'MyPopUp')">
      Open My Popup
    </span>
    A bit complicated when all you want is a pop up - but it works.

  • Flash Popup Window

    Hey, I want to make a flash popup window that opens up
    another frame on the click of a button. I want the window to be a
    custom size and custom options like a javascript popup window. I
    tried a few things with javascript but none of them worked. I dont
    want to have to edit the html, i want to just do this in
    actionscript.
    Somthing like this for example.
    Thanks!

    System Preferences->Flash Player->Storage:

  • How do I stop OSX from switching to First-Plan when Javascript popup on Minimized Window appear?

    I'm running OSX Mavericks 10.9.5, Firefox 39.7.0.2
    What happens is that i'm using an automated script with Selenium for automatic-forms-filling.
    Everything is working fine, just like it does on LinuxMint, but the problem is that when i bring another window to first plan (of any program at all) the "minimized" window running the automatic forms gets "maximized" i.e. brought to first plan when a javascript popup appears, thus not enabling me to run that window on background.
    Is there a way to run Firefox on OSX in such a way that Windows don't get switched to first plan when PopUps appear? It doesn't seem to have this behavior on LinuxMint.

    Hello!
    Maybe this links can help you:
    https://support.mozilla.org/pt-BR/kb/solucoes-de-problemas-com-plugins-como-flash-java
    https://support.mozilla.org/pt-BR/kb/como-desativar-applets-java
    This link scan your plug-in's and search for updates:
    https://www.mozilla.org/pt-BR/plugincheck/

Maybe you are looking for