Prevent the tiny box from closing when I click submit or click on something inside the instance.

Hello,

Is it possible to prevent tinybox from closing whenever the user clicks on a submit button or anything clickable that is located inside the tinybox? I am using the first version of the tinybox.

Thanks
asked Jun 27, 2012 by anonymous

1 Answer

0 votes
If a user clicks on something that naturally causes a postback or navigates away from the page then there isn't much you can do unless you want to cancel those respective actions. For instance if you don't want the form to post back you just need to return false on submission via Javascript. Same for links although I might be missing what the problem is because no doubt you have those elements there to be functional?
answered Jun 27, 2012 by Michael (5,600 points)
Thanks for your reply. I'm going to give precisions on what the problem is.

I would like to process code inside the tinybox and that the only way to get out of the box would be by clicking either outside (which is already possible given the code you've provided) or by using the "close" link that you have also provided.

If I use a form, I need the data to be sent to the advanced.php file that I use in the TINY.box.show(); function. I also need the tinybox pop-up to stay opened so that there can be a notice, inside the tinybox, saying that the files have been submitted.

The general idea is that I need the tinybox to stay opened while allowing me to use a form inside of it with code to process the data in the file I load using ajax.
You should be able to use the fill function in TinyBox. Something like instanceName.fill('POST URL', serialized form data). You will have to write another function to serialize the form data on submission and pass it to the fill function though.