Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Refresh form with new template (Priority support)
#1
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?
Reply
#2
Try clear template cache before:
TIWTemplateCache.Instance.ClearCache;
Reply
#3
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!
Reply
#4
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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)