AC_FL_RunContent not working after UpdatePanel postback - javascript

I have some javascript in a repeater item which calls AC_FL_RunContent to load and show a flash file (in each repeater item) when a link is clicked (link is part of repeater item).
I have a paged datasource showing the first page of video links. Five items on each page.
The show video links work fine on initial page when there hasn't been a postback from the UpdatePanel. Clicking the buttons opens a fancybox and shows the flash movie to play.
However after I have gone to the next 'page' of video links using the paged datasource.. (or try to subsequently go to the any other paged page') The AC_FL_RunContent does not seem to be working.
The fancybox still pops up, a test alert() with databound value still works. AC_FL_RunContent just doesn't seem to want to load the flash file.
If I remove the UpdatePanel. It works fine. But that is not an option i'm afraid.
So :
Databinding is working
Javasript still works (alert proves that)
Fancybox is still working
AC_FL_RunContent is just not loading flash file.
I have the following setup
UPDATEPANEL
--REPEATER
---- REPEATER_ITEM
------ SCRIPT
-------- alert('databound value');
-------- AC_FL_RunContent
Paged Data Source (within update panel)
Any thoughts?

I have done two different things in the past:
Use the Object tag
Wrap my AC_FL_RunContent calls in a JS function that is outside of the UpdatePanel. If you need to pass dynamic params, just make a generic JS function with the params you need.

Related

Oracle apex open file browser automatically on page load

I need to open "File Browse" item ("P50_BLOB") on page load.
I tried clicking the item with dynamic action on page load with javascript:
$('#P50_BLOB').click();
it didn't work, though it does work using the console.
I have also tried using async / wait / promise / wait for document to load.
I even tried to do it with another apex item that will make that click when it is changed, and manually changing the item is working, but on page load it's not.
This is supposed to be very simple but nothing works.
Thanks.
If you try that with the developer tools open in Chrome you will see an error:
Googling that led to this SO question:
File chooser dialog can only be shown with a user activation error while using web scraping through Javascript

WordPress timeout error ('Articles' admin link + WPML)

In my WordPress admin when I am inside a single article in the admin panel, and I click on the 'Articles' link on the left menu, I get my a timeout in my browser. This is very strange, because it happens ONLY when I click on that link inside an article: it doesn't happen when I click it from other sections of the panel, as when I'm in the dashboard or plugins section and I want to go to articles.
The second error I receive is when I click the 'Duplicate' button inside a post to translate that content in another language. The result is the same, 5 minutes loading and timeout error which leads to crash of the browser.
All plugins are updated, as well as the WordPress version. I have already tried to disable and activate each plugin one by one and this error comes anyway, also with all plugins disabled!!
I think it's not about WordPress version or plugins but it's like there's something which the system can't manage loading inside the article...I really can't figure out any solution.

Bootstrap-Switch on Modal loaded from remote page

I'm trying to use Bootstrap-Switch to toggle my checkboxes. It works fine on a normal page, or a modal thats pre-loaded into the page.
However, if I load the modal from a remote page (a href=something.html) the toggle does not work/display. Apparently it loads once but doesn't reload after the modal is opened.
I tried
$("#myModal").on("shown.bs.modal",function(){
$(".checkbox").bootstrapSwitch();
});
But to no avail.
I've tried added the JS code directly to the code being pulled from the Modal as well but it didn't work. It worked on the remote page when loaded directly, but not through the Modal.
I'm a novice JS guy so this may be a trivial fix. Basically need to know how to call bootstrapSwitch() after the modal is loaded.
Thanks!
Just realized I had the shown.bs.modal called 2x for different things. When I combined, it fixed it. Bah, 30 minutes down the drain!

Refreshing dynamic listviews in JQM when navigating between pages

I'm creating a mobile app using jquery mobile and cordova. I've successfully loaded a dynamic listview from a json ajax call. My issue is that when I navigate to another page, then press the back button, the original page's listview does not load and there is nothing where it should be. If I refresh the page, the listview appears. Rather than refresh the whole page every time I navigate to this page, how would I refresh just the listview?
I've tried refreshing the listview both when the DOM and the window have loaded, and before both, and using $(document).on("pagebeforeshow", "#pagenamehere", function() {}); to no avail.
To be more specific, I have two pages with listviews. The navigational steps go as follows:
1. load page 1: listview shows
2. navigate to page 2: its listview does not show
3. press back: page 1 listview shows
4. navigate to page 2: its listview still does not show
5. refresh page 2: its listview DOES show
6. press back: page 1's listview does NOT show
This process should make it clear that the listview only loads when the url is directly input or reloaded; for some reason navigation between pages (different html files) breaks this.
If you have script inside the head tag of the second page and this page is loaded through Ajax, then the script won't execute.
Try to move your script from the head tag inside the second page's div (<div data-role="page" id="mySecondPage">) or create a JS file and load it on the first page's load. Relevant example here
jQuery Mobile uses Ajax to perform pages transitions so during the transition jQuery Mobile will only inject the contents of the response's body element (or more specifically the data-role="page" element). Nothing in the head of the page will be used (except the page title).
In conclusion, any scripts and styles referenced in the head of a page won't have any effect when a page is loaded via Ajax. They will execute if the page is requested via HTTP and that's why your listview is loaded after a full page refresh.

jQuery AJAX back button after changing html

I know there are many questions about jQuery + Back button issues, but it seems that they're trying to maintain history features when clicking the browser back/forward buttons.
My question is that when clicking the back/forward button, how can I load ajax-affected html page?
For example,
In index.html, dynamically remove all "div" elements from the list using AJAX (jQuery.post()).
Press the browser back(or forward) button to go to newpage.html.
Press the browser forward(or back) button to go to index.html again.
PROBLEM: the html page contains the deleted "div" elements.
How should I load index.html with no "div" elements after step (3)?
I'm currently using jQuery and Django as backend.
Thanks!
Use the jQuery history plugin to encode the application state. See their Demos page for examples of how to do what you want.

Categories