Clarity Service Management

Expand all | Collapse all

Automatically close window after click save button

Jump to Best Answer
  • 1.  Automatically close window after click save button

    Posted 12-27-2015 09:47 PM

    Dear all,

     

    I would like to use close widow function in save button. For example, in update request page. after i click edit and click save this page will close automatic.

    How can i do about coding?

     

    pic1.png

     

    Regard,

    Chanopas



  • 2.  Re: Automatically close window after click save button
    Best Answer

    Posted 12-28-2015 01:45 AM

    Hi,

    as I found you need to define 3 arguments to make this work.

    1. define next_persid :

    ahdframeset.top_splash.next_persid = "<SOME_PERSID>";

    i'm using this while creating child objects, so persid were parents persistent id.

     

    2. update SET.id on form:

    var set_id = main_form.elements["SET.id"];

    set_id.value = "HTMPL=show_main_detail.htmpl&SET.id=" + "$args.id";

    set_id.name = "INPUT_FIELDS_TO_PARSE";

     

    To get more info, please refer to detailSave() function.

     

    Here is complete function that I'm using on my forms :

    function setAutoClose() {

        if (_dtl.edit) {

            var set_id = main_form.elements["SET.id"];

            set_id.value = "HTMPL=show_main_detail.htmpl&SET.id=" + "$args.id";

            set_id.name = "INPUT_FIELDS_TO_PARSE";

            ahdframeset.top_splash.next_persid = "z_mi_rep:" + argParentID;

        }

    }

    ...

    <BODY class="detailro" onunload="unloadActions();" onload="setAutoClose();">

     

    Regards,

    cdtj



  • 3.  Re: Automatically close window after click save button

    Posted 12-28-2015 02:17 AM

    Hi cdtj,

     

    Thanks It 's work for me



  • 4.  Re: Automatically close window after click save button

    Posted 12-28-2015 02:26 AM

    Hi cdtj,

     

    After i click edit and i don't do anything. After i click save  i found message Page load in progress. How can i fix it?

     

    pic1.png



  • 5.  Re: Automatically close window after click save button

    Posted 12-28-2015 02:52 AM

    try to define next_persid as object itself:

    ahdframeset.top_splash.next_persid = "$args.persistent_id";

    if this didn't work, check browser's console and stdlog for errors...

     

    regards,

    cdtj



  • 6.  Re: Automatically close window after click save button

    Posted 12-28-2015 03:14 AM

    Hi cdtj,

     

    It 's work. I have more question .If i would like to use with button Approve or reject button.  Can i use this code?

     

    pic2.png

     

    pic1.png

     

    Thanks



  • 7.  Re: Automatically close window after click save button

    Posted 12-28-2015 03:20 AM

    Nope, when you call custom webengine op, regular form edit didnt apply,

    use CALLBACK function instead. Examples could be found here: SPEL: Register custom webengine OP



  • 8.  Re: Automatically close window after click save button

    Posted 12-28-2015 03:34 AM
      |   view attached

    Hi Cdtj,

     

    This file is SPEL Macro code. Can you please help me modified it?

     

     

    Thank you

    Chanopas

    Attachment(s)

    zip
    z_chg_status.spl.zip   1K 1 version


  • 9.  Re: Automatically close window after click save button

    Posted 08-09-2017 04:25 PM

    Hi cdtj,

     

    I put the code you've posted and it worked in my page. However, I wish that the parent frame (in my case, it's a list of records) could be refreshed when I hit the 'Save' button. So, the new record will immediately appear in the list after saving it. I think this could be reached by putting "refreshForm()" command somewhere, but I'm not sure. Can you think where I could put it?

     

    Thanks,

     

    Diogo



  • 10.  Re: Automatically close window after click save button

    Posted 08-09-2017 04:49 PM

    Hi Diogo,

    if you're using popup, you can simply open it using this code:

    popupActivityWithURL(url, "status");

    how this works:

    if second argument matches some trigger words like alg or status, variable "_dtl.tabReloadOnSave" on child form become true. If you're using some other way to open child form you can try to define this attr on child form manually.

     

    It this willn't work, you can try to call refresh parent on form close:

    <body ......... onunload="zRefreshParent();">
    function zRefreshParent() {
    parent.opener.location.reload();
    }

    Regards,

    cdtj



  • 11.  Re: Automatically close window after click save button

    Posted 08-10-2017 10:22 AM

    Hi cdtj,

     

    Thanks for your response. Currently, I'm using preparePopup() function to open a new window. I've tried using popupActivityWithURL() instead, but it didn't succeed.

     

    I've tried defining manually _dtl.tabReloadOnSave variable, however I get an error because '_dtl' object is not defined in parent.opener, for some reason I don't know yet.

     

    About parent.opener.location.reload() function, it works fine when I execute it in browser console. But it does not seem to be even executed when I put it as a unload actions.

     

    Any thoughts on this matter?

     

    Thanks,

     

    Diogo