This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

Autoclose page/modal window after review/submit


  1. zforray
    Member

    I searched for this topic but since both replies were from >2-years ago, I wanted to re-ask this question for V3.

    I am creating individual forms for emails to multiple persons (thus hiding the true email addresses) and am using a pop-up/modal window.

    I would like to close the modal window after they review and click submit. How can I do this?

    I am using Likno to generate the modal window and they say to close a window programatically, to use the code such as:

    <a class="likno-modal-project-close" href="javascript:void(0)">Close this window</a>
    <img src="any_image_here.jpg" class="likno-modal-project-close" width="250" height="233"/>
    <a onclick="likno_modal_project.close();" href="javascript:void(0)">Close this window</a>
    <img src="any_image_here.jpg" onclick="likno_modal_project.close();" width="250" height="233"/>

    but I want it to close automatically, not make them have to click on a button.

    Posted 11 years ago #
  2. yuniar

    You can add the javascript code into your success message.
    Below your success message, add this code:

    <script>
    var close_delay = 2000;
    
    t = null;
    function closeMe(){
      t = setTimeout("self.close()",close_delay);
    };
    
    closeMe();
    </script>

    That should close the window after 2 seconds.

    However, you need to change all those code into a single line. So, remove any new lines.

    I don't think this is a good idea though. Some of your users might get confused and thought there was some error with the submission. I believe having the user to click to close the window is much more usable. It's your choice though.


    MachForm Founder

    Posted 11 years ago #
  3. zforray
    Member

    Thanks for the code (I was unaware of how much I can put into a message area). I understand your hesitation. However, I don't feel the need for the "success message" at all. As I mentioned, this is just to send an email. I basically want it to immediately close the window when they click submit, so I will lower the "close_delay" to almost nothing.

    Posted 11 years ago #
  4. zforray
    Member

    Unfortunately, all efforts to get this to work have failed. My guess is since your code didn't invoke this window, the close doesn't work. There was something in the Likno doc about using "parent."?

    Posted 11 years ago #

RSS feed for this topic

Reply