reload window after 'frm-entry-update-field'

Est. Reading: 1 minute
Created: 01/10/2017
Category:
Difficulty: Intermediate

reload window after 'frm-entry-update-field'

×Warning: This tutorial was created 2681 days ago. Some of the information may be out of date with more recent versions of Formidable. Please proceed with caution and always perform a backup before adding custom code.

I had an issue where a modal window had a 'frm-entry-update-field' that changed a value on the parent form. Once the modal closed I wanted the parent to reload to see the value. I tried the <button onCLick="reload"> however every now and then the button would fire before the ajax, so after digging heres some code to check which ajax function completes the 'value' in the settings.data is the url for the ajax function you can check for other values such as the label or message etc... some Ajax functions fire that are not passing values hence the check for 'undefined'. You can also check for a value that is from a modal and then add a parent.location.reload().Hope this is of use, I am an amateur javascript/ajax coder so any glaring errors please adjust my code or let me know. Thx.function getAjaxVariable(variable){var query = variable;var vars = query.split("&");for (var i=0;i<vars.length;i++) {var pair = vars[i].split("=");if(pair[0] == "value"){return pair[1];}}return(false);}jQuery(document).ready(function($){$( document ).ajaxComplete(function( event,request, settings ) {var query = settings.data;if(query != undefined) {var res=getAjaxVariable(query);if(res=="Deposit+Paid" || res=="Enquiry" || res=="Booked" || res=="Balance+Paid" || res=="Pending" || res=="Cancelled"){location.reload();}}});});</script>

Leave a Reply

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crosschevron-leftchevron-rightarrow-right