Close popup window

Hi experts,
There is a popup window, with two button:
SAVE
CANCEL.
i create the popup in this way:
lr_popup = lr_window_manager->create_window(
    modal               = abap_true
    window_name         = 'WND_POPUP'
    title               = lv_text
    close_button        = abap_true
    button_kind         = if_wd_window=>co_buttons_yesno
    message_type        = if_wd_window=>CO_MSG_TYPE_NONE
    close_in_any_case   = abap_true
lr_view_controller = wd_this->wd_get_api( ).
   lr_popup->subscribe_to_button_event(
                   button            = if_wd_window=>co_button_yes
                   button_text       =  'Save'
                   action_name       = 'SAVE'
                   action_view       = lr_view_controller
                   is_default_button = abap_true ).
   lr_popup->subscribe_to_button_event(
                   button            = if_wd_window=>co_button_no
                   button_text       = 'Cancel'
                   action_name       = 'CANCEL'
                   action_view       = lr_view_controller
                   is_default_button = abap_true ).
   lr_popup->open( ).
My problem is that, if the user press the SAVE button,  then I have to make some checks, and if they don't pass, an error message should be created, and the popup shouldn't close.
My question is: How can I do that?
It's ok that if I use the paramter:
close_in_any_case   = abap_false
then the popup isn't closed, but how can I close it in the action handler method of the Close button (or the save when the cehcks are fine)
Thnaks.
N.

Hi,
When there are errors do you want to display them on popup. If there are errors and user closes the window(click on close) button then these errors are shown in parent view rather on popup window.
Do you want to handle this also..
In addition to making that close_button as abap_false. there is a method to handle on button close in if_wd_window interface.
Try to use and write the close window code.
If you donot want to show the errors in parent view, In the abobe metthod for window close, clear all the messages and then close the window.
check out this link -
Re: Form field validation messages in pop-up window
Regards,
Lekha.

Similar Messages

  • Save and close popup window

    I have a typical popup window launched using the builtin javascript:popupURL().
    I would like a Save and Close button on this popup window that does
    1. Submits the popup page so that changes are saved into session state
    2. Close the popup window
    3. Refresh the parent window so that updates in (1) are reflected
    What is the recommended way of doing this? I was thinking of the following URL redirect on the Save & Close button
    doSubmit('SAVE');
    window.opener.location.reload();
    window.close();Do I need a same-page branch on the popup page? If so, why? If not, why? ;-)
    Comments?
    Thanks

    This is a bit of javascript that I nicked which works well for me:
    -- 1. Add the folowing to your page header or create a new page template --
    -- (popup window template) and put it in the header section. --
    SCRIPT LANGUAGE="JavaScript">
    function loadinparent(url, closeSelf){
         self.opener.location = url;
         if(closeSelf) self.close();
    </SCRIPT>
    -- 2. Use the following to call the function. the true and false keeps the parent--
    -- window open or closed. Obviously set any values in the URL. --
    javascript:loadinparent(''<URL>'', true)
    eg. javascript:loadinparent(''f?p=&APP_ID.:40:&SESSION.::NO::P40_ID:'||ID||''', true)
    -- Inc the following comment in your header --
    -- Version 1.0
    -- Last Updated: May 18, 2000
    -- Code maintained at:
    -- http://www.moock.org/webdesign/javascript/
    -- Copy permission granted any use provided this notice is unaltered.
    -- Written by Colin Moock.
    Simon

  • Close popup window and refresh the parent window

    Hello,
    I have a button in a normal report, when clicked opens up an popup window which is a form containing some items and here in this form (i have some editable text items) I make some changes and click on the apply changes button -- this should update the form, close the popup window and should refresh the parent window.
    can anyone please help me out with this issue.
    Thanks,
    Orton

    you have your popup window. When they apply the changes you want it to close the window, right?
    Modify the button (save, apply changes) and give it url redirect to the custom function you create (See below): javascript:saveChanges();
    in the page header, add a new function:
    <script type="text/javascript">
    function saveChanges(){
         doSubmit('SAVE');//this is the line to save the current form on the popup window. (This assumes SAVE is the request value that should udpate the db)
         window.close();//close the popup window
         window.opener.doSubmit('REFRESH');//call doSubmit function on the parent window to cause the page to refresh.
    </script>

  • Close Popup window in webdynpro abap.

    Hi,
    Can anyone tell me ...how to close the popup window through the action in webdynpro abap . In my popup window there is a button(i.e 'UPDATE') apart from that  default 'OK' button , I want that when 'UPDATE' button is pressed, along with the action window should be closed. I dont want to close the window by pressing 'OK' button at the botton
    I have used following code to open the popup window.
    data lo_window_manager type ref to if_wd_window_manager.
    data lo_api_component  type ref to if_wd_component.
    data lo_window         type ref to if_wd_window.
    lo_api_component  = wd_comp_controller->wd_get_api( ).
    lo_window_manager = lo_api_component->get_window_manager( ).
    lo_window         = lo_window_manager->create_window(
                       window_name            = 'POP_UP  WINDOW'
                       title                  = ''
                      close_in_any_case      = abap_true
                       message_display_mode   = if_wd_window=>co_msg_display_mode_selected
                     close_button           = abap_true
                       button_kind            = if_wd_window=>co_buttons_ok
                       message_type           = if_wd_window=>co_msg_type_none
                       default_button         = if_wd_window=>co_button_ok
    lo_window->open( ).

    Hi Dear,
    please try this code,
    DATA lv_wc TYPE REF TO IF_WD_WINDOW_CONTROLLER.
    data lv_view TYPE REF TO IF_WD_VIEW_CONTROLLER.
    data lo_window  type ref to if_wd_window.
    lv_view = wd_this->wd_get_api( ).
      lv_wc = lv_view->GET_EMBEDDING_WINDOW_CTLR( ).
       lo_window =  lv_wc ->GET_WINDOW( ).
       lo_window->CLOSE( ).
    Message was edited by: kumar.k kulanthaivel
    Regards,
    K. Karthikeyan

  • Don't close popup window on action

    Hello!
    I have a popup window, which contains another window from my component. I assigned actions to buttons. I need not to close popup after action in some cases. I want to decide in action's method. How can I avoid closing the popup?
    Edited by: Konstantin Milutin on Feb 24, 2010 12:55 PM

    Hi,
    when u are creating the pop up window then there is a parameter close_in_any_case set its value as abap_false.

  • Close popup window for swf file

    The captivate movie plays properly in the popup window. The
    "Close Movie" command does not automatically close the popup window
    on some computers. Any sugestions?

    You said, "Some customers?" does it work for other customers?
    Is there a difference between the way two customers are viewing the
    file? Compare the two, and you may get some hints.
    thanks

  • How to Close Popup Window

    Hi All,
    in my main View iam calling a popup window, there i select some values and when i click select button i want to close the popup window.
    Thanks,
    RAju.

    Hi Raju,
    What you can do is while creating the pop window you can take the reference of window manager in some reference attribute of type IF_WD_WINDOW in component controller like.
    wd_comp_controller->gr_window         =
    lr_window_manager->create_window(
                         window_name            = 'Window'
    if_wd_window=>co_msg_display_mode_selected
    *                  close_button           = abap_true
                         button_kind            = if_wd_window=>co_buttons_ok
                         message_type           = if_wd_window=>co_msg_type_none
                         default_button         = if_wd_window=>co_button_ok
    **and now you can call the close method of window at the event you want to close pop up window.
    wd_comp_controller->gr_window->close().
    Regards
    Amol

  • ESC close Popup-Window

    Hi,
    i have created a popup-window with
      wd_comp_controller->window         = lo_window_manager->create_window_for_cmp_usage(
                         interface_view_name    = 'W_DEFAULT'
                         component_usage_name   = 'XYZ'
                     title                  =
                     close_in_any_case      = abap_true
                         message_display_mode   = if_wd_window=>co_msg_display_mode_selected
      wd_comp_controller->window->open( ).
    Now I have the problem, that the window will be closed if I press ESC.
    Is there a possibility to catch this event.
    Regards,
    Marcus

    Hi ,
    when u press Esc then the method WDDOONCLOSE of the window is called ..
    Regards
    Yash

  • How to auto close popup window of UWL?

    Hi everyone! I have developed a web dynpro abap application that is being launched by the UWL in a new window. How do I close the window after the web dynpro application is done processing? I cannot use exit-plugs as these don't work in the portal. If I use the portal navigation classes(absolute and relative) these ask for a target address but what I want is to close the window. Has anyone done this before? Thanks! Generous points will be awarded!

    If you are ready to open your webdynpro application inside the UWL itself (instead of opening as a pop up) you can try the following. In such a case you can set a re-direction page which points out to the URL of your UWL on the required action (say "Approve" or "Reject"). Hence when you perform the required action your UWL screen will be re-displayed once again.
    If you want only pop up from UWL then you may try posting it in Web Dynpro ABAP.
    Thanks,
    Prasath N

  • Close popup window from loaded movie

    I have an html link which launches a flash movie into a
    separate html window. The flash movie then loads another movie into
    level 10. from this level, I am trying to close the flash movie and
    its associated html page using the code:-
    javascript:window.close();
    This doesn't work. It closes level 10, but leaves level 0 and
    the html page intact. How can I resolve it?
    Any help would be very much appreciated.

    I have carried out a simple test using the above code to
    close a single swf with no loaded movies. This works. However, when
    I try to load a movie into a higher level and close the whole movie
    together with its html page from there, it doesn't work.
    Thanks

  • Modal Popup Window close issue

    Hi,
    i have a master detail form
    i added a link field on detail form to open a form in popup modal mode
    i putted on Link Attributes onClick="new Ext.ux.PopupWindow({url: this.href, height: 450}).show(); return false;"
    due Modal Popup Window example by Mark Lancaster
    ([http://oracleinsights.blogspot.com/2009/09/apex-modal-windows-are-snap-using-extjs.html])
    I can't close popup window and return on calling page
    Any help?
    Thanks in advance
    Lukx
    so --> win xp
    rdbms --> 10.2.0.4
    apex --> 4.0.2.00.07

    Hi lukx
    You will find additional information in the comments on my blog that will solve your problem.
    Also, my book contains an even better solution for this in chapter 10, page 334.
    Regards
    Mark
    demo: http://apex.oracle.com/pls/otn/f?p=200801 |
    blog: http://oracleinsights.blogspot.com |
    book: Oracle Application Express 4.0 with Ext JS

  • Form in a popup window

    Hello
    I have a button on a page opening a popup window. This popup window includes a page with form and the classical Create Cancel Submit Delete buttons.
    Of course, when clicking Cancel, Submit or other buttons, the popup does not close and I end up with the target page in the popup !
    How can I solve this ? (I'm using apex 4)
    Edited by: Arnaud Ladrière on 26 août 2010 16:16

    Hi Arnaud,
    You may find it useful to refer to the Build Custom Popup Pages 'How To' available here: http://www.oracle.com/technetwork/developer-tools/apex/how-to-create-custom-popups-085945.html , which outlines the steps to create the popup, including the JavaScript to pass back values to the parent page and then close the popup.
    There's also numerous related threads on the forum which could also prove useful to you:
    http://forums.oracle.com/forums/search.jspa?threadID=&q=how+to+close+popup+window&objID=f137&dateRange=last90days&userID=&numResults=15
    Regards,
    Hilary

  • Close popup on completion of procedure

    I have built a custom popup that I use to record a value in conjunction with the current screen. The popup gathers values from the current screen, asks the user for a little more input, then saves the records. The procedure is working great. After the procedure completes, I would like to close the popup window.
    I've tried two things: using a Close Popup Window procedure and using hints from this thread:
    Re: Close popup after MRU
    I had it working (the close part) but I had to go back and alter some of my page and now it isn't working again. Can someone suggest what to look at?
    HTML header:
    <script language="JavaScript" type="text/javascript">
    function closeWindow()
    if ( document.getElementById("P1069_SAVESTATUS").value == 'R' )
      window.opener.location.href=window.opener.location.href;
      window.close();
    </script>One HTML region, source is:
    <script language="JavaScript" type="text/javascript">
      onLoad="closeWindow();"
    </script>Region item P1069_SAVESTATUS     is set as Hidden, set to 'N' when session state is null.
    Process is as follows (triggered by FINISH button):
    declare
      v_job        NUMBER     := :P1069_TC_ID;
      v_dt         DATE       := to_date(:P1069_DT,'MM/DD/YYYY');
      v_emp        NUMBER     := :P1069_EMP_ID;
      v_pkg        NUMBER     := :P1069_PKG_ID;
      cursor c_pkg is select COURSE_ID from TRAINING_PKG_ASSIGN
                where COURSE_PKG_ID = v_pkg and COURSE_ID > 0
                order by COURSE_ORDER;
      v_crs        NUMBER;
      v_eemp       NUMBER     := :G_USER_ID;
      v_edt        DATE       := SYSDATE;
    begin
      delete from EMP_TRN_HISTORY
       where TC_ID = v_job;
      open c_pkg;
        LOOP
          FETCH c_pkg into v_crs;
          EXIT WHEN c_pkg%NOTFOUND;
            insert into EMP_TRN_HISTORY (EVENT_ID, EVENT_DATE, TRN_CRS_ID,
                  ENTRY_EMP_ID, ENTRY_DATE, TC_ID, EMP_ID, PKG_ID)     
               values (SEQ_EMP_HISTORY.nextval, v_dt, v_crs,
                     v_eemp, v_edt, v_job, v_emp, v_pkg);
        END LOOP;
      close c_pkg;
      :P1069_SAVESTATUS  := 'R';
    end;

    Try changing the HTML in your region to
    <script language="JavaScript" type="text/javascript">
      closeWindow();
    </script>the onload="" notation would be used if you were putting the function call in the <BODY> tag of the page.

  • Lifespan of popup window

    Hello!
    I want controller of a popup window be initialized every time when the window is opened. Is that possible?
    I've defined Lifespan for the view "when_visible", but doInit is called only first time, the window was opened.
    Of course, I could invalidate context on closing the window (as I manage to fire event, that the window can be closed), but may be there is a simple way to make lifespan working similar to "normal" views?
    Thank you!
    Best regards,
    Nick

    Hi Wael,
    I'm not pretty sure about terminology, I think I'm using "regular popup", though I'm doing similar things to Tutorial 10 "Dialog Boxes in Web Dynpro":
    - define a new window and a view in WD component
    - open the window using
         IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows(NAME);
         IWDWindow window = wdComponentAPI.getWindowManager().createWindow( windowInfo, true);
         window.setWindowPosition(WDWindowPos.CENTER);
         window.open();
    - save the window instance in context of the current view
    - Define an event in controller
    - add event processor to the current view to close popup window by
           IWDWindow window = wdContext.currentContextElement().getPopupWindowInstance();
           window.close();
    - popup window triggers the event in controller and 'parent' view closes the popup.
    Best regards,
    Nick

  • Popup Window - Passing Parameters

    I need some help w/ popup windows and passing parameters back and forth.
    On page 7 (report page), I have:
    - TXT_P7_SALESREP displays the names of the selected sales reps, defaults to All
    - CMD_P7_PICKSALESREP opens the pop up window when clicked
    - H_P7_SALESREPIDLIST stores the list of the currently selected sales rep ids (used to generate the report)
    On page 10 (popup page), I have:
    - CBL_P10_SALESREP a check box list of all sales reps (by name)
    - H_P10_SALESREPIDLIST stores the list of currently selected sales rep ids
    - CMD_P10_OK to submit the changes and close the page
    - CMD_P10_CANCEL to close the popup window w/o saving any changes (I got this working already via the close popup window process)
    The process should be something like:1) User opens report page, 'All' is displayed in the text box, and H_P7_SALESREPIDLIST contains all the sales rep ids
    2) User clicks CMD_P7_PICKSALESREP to change list of sales reps
          2a) Popup window opens & the value of H_P10_SALESREPIDLIST is set to the value of H_P7_SALESREPIDLIST
          2b) CBL_P10_SALESREP has values checked based on the value of H_P10_SALESREPIDLIST (all by default, but a user could change sales reps multiple times)
    3) User makes their changes and hits OK
          3a) Value of H_P10_SALESREPIDLIST is updated w/ list of currently selected sales reps
          3b) Value of H_P7_SALESREPIDLIST is updated w/ the value of H_P10_SALESREPIDLIST
          3c) Popup window is closed, returning the user to the report page
          3d) TXT_P7_SALESREP is updated via the contents of H_P7_SALESREPIDLIST
    4) User runs the report which is processed/displayed based on the values of H_P7_SALESREPIDLISTI tried putting javascript:popupURL('f?p=&APP_ID.:10:&SESSION.::NO::H_P10_SALESREPIDLIST:&H_P7_SALESREPIDLIST'); in the URL Target for CMD_P7_PICKSALESREP, but it didn't work. I just dont know enough about passing parameters and APEX-specifics to set this up myself. Any help would be appreciated.
    I'd prefer to do this w/ as little javascript coding as possible, but I understand it may be necessary.

    Hello
    Change the URL for CMD_P7_PICKSALESREP to be
    javascript:showPopup();
    Add the JS below into the HTML Header of page 7 <script>
    function showPopup() {
    popupURL('f?p=&APP_ID.:10:&SESSION.::NO::H_P10_SALESREPIDLIST:' +  $v('H_P7_SALESREPIDLIST') )
    </script>Change the URL for CMD_P10_OK to be
    javascript:updateValues();
    Add the JS below into the HTML header of page 10 <script>
    function updateValeus() {
    $s('H_P10_SALESREPIDLIST', $v('CBL_P10_SALESREP') )
    window.opener.document.getElementById('H_P7_SALESREPIDLIST').value= $v('H_P10_SALESREPIDLIST')
    window.opener.document.getElementById('H_P10_SALESREPIDLIST').value= $v('H_P10_SALESREPIDLIST')
    doSubmit();
    window.close();
    </script>varad

Maybe you are looking for