Refresh a lookup field (only)

By: Rudi JvR | Asked: 06/26/2023
ForumsCategory: General questionsRefresh a lookup field (only)
Rudi JvR asked 10 months ago

I have a form with many fields one of which is a lookup referencing another form to populate a Dropdown field.  

I'm using a Modal Popup to access the source form for my lookup to capture new entries if required.  

Unfortunately the Lookup field doesn't refresh after submitting a new value from the Modal Popup (Ajax submit).  Is there a hook I can use to refresh only the Lookup field after a new entry was added via the Modal popup form?    

1 Answers
Bobby Clapp answered 9 months ago

I don't have a great example, but it's going to be something like:

$(document).ajaxComplete(function(){
$("#mydiv").load(location.href + " #mydiv");
});

Where #mydiv represents the ID of the form field you want to "reload" without a page refresh.

Khaldoun Dahnous replied 8 months ago

Thanks very much , where i can put this code ?

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
crossarrow-right