I am working on a plugin where I want to display a form in a popup. The form contains a text input that is configured to use the pgEmailSuggestions as its pgsrc attribute so that I can retrieve users from that input.
I use the Javascript api.PopupManager class to create a FancyPopup object. I populate this popup using its setHtml() method where the HTML comes from an Ajax request.
I have also created a global object for my plugin which has an array that I use as a cache for popups. This works all fine.
When the user clicks on the Cancel button, I want to hide the popup and the form to be reset. I have attached a listener to the click event that uses the hide() method of the popup. This works fine with a normal plain text input in the form. However, when the popup is displayed again, the rich text input, i.e. the one using pgEmailSuggestions, has not been reset.
I have even tried to clear my popup cache when the user clicks Cancel and create a new popup from a fresh Ajax request. However, the content of the text input is still the same as before the Cancel button was clicked instead of being the content from the Ajax response.
Are these fancy text input caching their content somehow? And if so, how can I clear/reset them?