|
<< Click to Display Table of Contents >> Navigation: Forum > Refresh form with new template (Priority support) |
04-25-2023, 04:51 PM:
I am using Intraweb 15.3.3 with Rad Studio 10.2.3 (C++ Builder).
I need to be able to change the template loaded by the form each time the user chooses a different language.
The language selection is done through JavaScript : executeAjaxEvent(LanguageCode, null,"ChangeLanguage", true, null, false) which unfortunately does not force a refresh on the form!
ChangeLanguage(TStringList *Parametres)
{
UnicodeString CodeLanguage = Parametres->Values["Code"];
IWTemplateProcessorHTML1->Templates->Default = "myTemplate-" + CodeLanguage + ".html";
}
IWForm->AsyncReload() works but it prompts a message to the user which is a problem!
So, how can I force a refresh on the form when a new template is loaded without any message prompted to the user? Or another way to load a new template with form refresh?
04-26-2023, 01:34 AM:
Try clear template cache before:
TIWTemplateCache.Instance.ClearCache;
04-27-2023, 06:25 PM:
This does not resolve the problem.
The issue is not that the page is cached. The problem is that the page does not refresh to reflect the changes!
04-28-2023, 05:17 PM:
I found a solution which works!
I am posting it here because I think it may help other developers.
The link to run the Ajax function to switch the template is written like that:
<a href="#" onclick="JsFunction()">
The href="#" links to the current page. But if you remove # and write it like that:
<a href="" onclick="JsFunction()">
It refreshes the page without prompting any message!