Online Express form reload
I was recently asked to add an Online Express donation page to my Single Page Application. It works great the first time you go to the donation view, but in all subsequent visits the form's javascript does not execute and you have to refresh/reload the site. Because this is a SPA when you leave the donation view the form is dropped from the DOM. I then use the code below to also remove the javascript file and the load function.
I used the following code in the donation view to load/reload the form
var elm = document.getElementById("EmbeddedDonationsScript");
if (elm !== null) {
var jqEl = angular.element(elm);
jqEl.remove();
if (typeof window.bboxInit === "function") {
window.bboxInit = null; // because it is still in memory
}
}
window.bboxInit = function () {
bbox.showForm(embeddedKey);
};
elm = document.createElement('script');
elm.id = "EmbeddedDonationsScript";
elm.async = true;
elm.src = embeddedURL;
document.getElementsByTagName('head')[0].appendChild(elm);
I think there is more that needs to be removed from memory before the form is reloaded. Thoughts?
I used the following code in the donation view to load/reload the form
var elm = document.getElementById("EmbeddedDonationsScript");
if (elm !== null) {
var jqEl = angular.element(elm);
jqEl.remove();
if (typeof window.bboxInit === "function") {
window.bboxInit = null; // because it is still in memory
}
}
window.bboxInit = function () {
bbox.showForm(embeddedKey);
};
elm = document.createElement('script');
elm.id = "EmbeddedDonationsScript";
elm.async = true;
elm.src = embeddedURL;
document.getElementsByTagName('head')[0].appendChild(elm);
I think there is more that needs to be removed from memory before the form is reloaded. Thoughts?
Tagged:
0
Categories
- All Categories
- 6 Blackbaud Community Help
- 211 bbcon®
- 1.4K Blackbaud Altru®
- 402 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 360 Blackbaud eTapestry®
- 2.6K Blackbaud Financial Edge NXT®
- 656 Blackbaud Grantmaking™
- 577 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 941 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.7K Blackbaud Raiser's Edge NXT®
- 3.7K SKY Developer
- 248 ResearchPoint™
- 120 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 240 Member Lounge (Just for Fun)
- 34 Blackbaud Community Challenges
- 37 PowerUp Challenges
- 3 (Open) PowerUp Challenge: Grid View Batch
- 3 (Closed) PowerUp Challenge: Chat for Blackbaud AI
- 3 (Closed) PowerUp Challenge: Data Health
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 796 Community News
- 3K Jobs Board
- 54 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)
