December 19th, 2012LWMW: How can I close a modal window on a form submission?
Knowledge Base support case for Likno Web Modal Windows Builder, abstracted and stripped of all user’s private info.
Initial Email From: Jim
Initial Email Subject: Close window on form submission...
Support Case Month: June 2012
Hello,
I have a question all together. I have a project I am working on and I created a Modal Window for this project. The modal window contains a Password Retrieval where you enter your email and submit to have your password emailed to you, standard form, nothing special. I have it working the way I want it to but what I need to have happen is for the window to close when the form is submitted. This is the form variable;
<form name="flogin" id="flogin" class="ewForm" action="<%= ew_CurrentPage %>" method="post" onsubmit="return ewForms[this.id].Submit();">
Can I add something to this that will close the window upon successful submission?
Thanks
Jim
Reply From: Likno Customer Support
Dear Jim,
There are two ways to handle this:
1) if you want the form to load the resulting page (be it successful or not) in the parent window, then give a “target” to your form:
<form target="_top" name="flogin" id="flogin" class="ewForm" action="<%= ew_CurrentPage %>" method="post" onsubmit="return ewForms[this.id].Submit();">
2) you can load the resulting page in the modal and have it contain a “close” button, or even have it close the modal automatically by adding the relevant code at the end of the page, for example:
<script>top.likno_modal_project.close();</script>
(this is of course assuming that your modal project compile name is “likno-modal-project” which is the default compile name)
Regards,
Kostas
Likno Customer Support
www.likno.com
Create any type of javascript menu (CSS menu, drop-down menu, sliding menu), button, html tree, modal window, tooltip, accordion, tab, scroller, jQuery slider or design for your websites!
Like us on Facebook – Follow us on Twitter
Tags: close, code, form, jquery, load, modal, modal window, project, submission, target, variable, website, window