Forums

Closing modal window not working in CF 4.0.1 on Joomla 3.1.5

jennifer 03 Dec, 2013
I have Chronoforms 4.0 installed on a Joomla 2.5 site and have a form that opens in a modal window. I am opening the form from a component with the code :

window.addEvent('domready', function() {

		  SqueezeBox.open("index.php?option=com_chronoforms&chronoform=RegisterNow&tmpl=component", {
			  handler: 'iframe',
			  size: { x: 690, y: 375 }
		  });

		});


In the form events, the very last action I have in OnSubmit is a Load JS action. In the configuration for the action, I have


window.setTimeout('closeme();', 300);
function closeme()
{
parent.SqueezeBox.close();
}


This works great. The modal window closes automatically after the form is submitted.

I have the same thing set up on a Joomla 3.1.5 site with Chronoforms 4.0.1 and the modal window does not close. Instead, when the form is submitted, the home page of the site is loaded in the modal window.

Does anyone have any ideas why it isn't working or what I might change to get the modal window to close when the form is submitted?

Jennifer
skittle 07 Dec, 2013
Hi Jennifer,

I am not trying to hijack this thread! I have a somewhat similar problem and thought that by posting it here, perhaps both of us could benefit from the same responses to this thread, or, perhaps some of my information can help you.

I have a number of different Joomla 3 sites and one Joomla 2.5 site running CF4 that all make extensive use of modal windows so my (and your) problem may not be related to the Joomla version. All my sites have worked perfectly for quite some time (until yesterday). In my case, perfectly means that when the user pressed Submit, the modal window closed and the parent (usually a Chronoconnection List View) refreshed. The code I am using to close the modal windows and refresh the parent is:


window.setTimeout('closeme();', 200);
function closeme()
{
window.parent.document.location.reload();
parent.SqueezeBox.close();
}


This is installed in a Load JS action running as the last action in the On Submit event of each form.

I open the windows with links that look like this example:

<a class="modal" href="index.php?option=com_chronoforms&tmpl=component&chronoform=OrganizationAdd" rel="{handler: 'iframe', size: {x: 750, y: 530}}"><input style="width:125px !important; " class="btn btn-small" type="button" value="Add Organization"></a>


Yesterday, the modal windows on my one and only site running Joomla 2.5 and CF4 stopped closing automatically after the user pressed the Submit button. Now, after clicking on Submit the user just gets a blank modal window that doesn't close (all of the fields disappear from the modal window and the window just stays open). The user has to close the modal window by hand and the parent window no longer refreshes. The behavior is the same regardless of the browser used. Everything else in my CC4 and CF4 based Joomla 2.5 system seems to work as before and as expected.

I have been working for hours to solve this problem. I have placed alert() popups in the Javascript that closes the window. I have removed window.parent.document.location.reload() from the function so that the only command inside the closeme() function is parent.SqueezeBox.close();. If an alert() is placed on the line immediately before parent.SqueezeBox.close(); the alert message appears on the screen, so we know the Javascript is running and getting to the parent.Squeezebox.close() call. (This code did work for months on my Joomla 2.5 site and continues to work on my Joomla 3 sites.)

I have also uninstalled all unused and nonessential plugins, modules and components from the Joomla 2.5 site. I disabled all plugins, modules and components that were known to have been updated just before the problem started (just 2) and I disabled a component that was installed yesterday. Nothing has had any impact on this problem. Ideas or suggestions are welcome!

Thanks,

John
This topic is locked and no more replies can be posted.