Floatrbox wont close

Page: 1

Author Post
Member
Registered: May 2016
Posts: 9
Ok so I have a link on a grid.

class="floatbox" data-fb-options="afterBoxEnd:`fb.$( 'theframe' ).contentWindow.location.reload()` showOuterClose: true overlayFadeTime:0 overlayOpacity:0"

The link goes to a page that does a quick update for that record and then redirects to a close_sql.php page that has this:
echo "<script language = 'javascript'>parent.fb.end();</script>";

Now this works EVERYWHERE else in the site... except this page.
The floatbox stays open and wont close until you click the close icon.

The difference on this page is that usually the links go to a record form of some sort, and then redirects to the close page.

But in this instance I want it to just do the update and auto close.. no intermediary page and that seems to be messing something up in terms of the floatbox closing.
Any pointers?

Basically I dont want a floatbox to appear .. I just want to use its "maintain scroll position and refresh the frame" abilities. :)
Member
Registered: May 2016
Posts: 9
Dig some digging around .. the error I am seeing on the close page is parent.fb is undefined.
Administrator
Registered: Aug 2008
Posts: 3382
I really can't follow this, but I'm not sure I want to anyway. We are well outside the realm of Floatbox support and are talking about the logic, structure and data flow of your pages.

But I will say this:
If you don't want a floatbox to appear, don't put up a link with the floatbox class on it to start it. If you're just using the floatbox to redirect the page, forget the floatbox altogether and just redirect the page directly. If you're calling parent.fb but fb is not on the parent, put it on the parent with the standard floatbox.js include line.

I can help with Floatbox issues, but I can't help with general scripting and page flow issues beyond the vague suggestions given above.
Member
Registered: May 2016
Posts: 9
Ok thanks for those tips..
I guess am trying to extend floatbox 's capability😀.
By using floatbox to go to a page with an update record scrip t and quickly come back and fresh the iframe..its acting like an easy Rest/ Ajax service.
Administrator
Registered: Aug 2008
Posts: 3382
You may be interested in the fb.ajax() function from the Floatbox API, which includes easy form submission and completion callbacks. Check it out in the API Reference.

You may also be interested in the 'AJAX form example', the first example on the 'Forms' tab of the demo page. This uses fb.ajax for the form submission and includes calling fb.end() to close the floatbox after successful submission.

The PHP backend source is listed under the example which may be useful for lifting ideas from, but please note that Floatbox support does not extend to modifying or building backend code beyond what is provided for illustration purposes only.

Page: 1