Hi, Is there an API to set the theme of an application? If yes, which? If no, how does TEAM do this in their application? Kind regards, Jan Willem |
Hi Jan, Formspider does not have this API but it is still possible to change the CSS of an application using the method explained in this thread. http://osqa.theformspider.com/questions/726/apply-different-css-when-starting-application We think we should add this API to Formspider, so I created a ticket for this issue. Kind Regards, |
Hi Yalim, I want to enable users to set the theme for their sessions. Just like the TEAM example on your homepage. How do they do that if there is no API? Kind regards, Jan Willem Hi Jan, The link I shared above explains how it is done. TEAM does it the same way. Kind Regards,
(10 Sep '15, 08:09)
Yalim Gerger ♦♦
|
Hi Yalim, Some users are complaining about the colors of my application so i am working on this subject again. But i can not get this working. I have created javascript planmysport.js with this function:
And have placed this file in the /webapps/formspider/js folder. And set the link in the main.jsp file in the /webapps/formspider folder.
Then i have stopped/started tomcat, removed all temporary files from my browser and run the application. The first problem then occurs: it does not seem to load the script.
Also, in the html source i can see that all skins are loaded:
I have written some plsql-code to change from one skin to the other:
What values do i have to give to new_file_name? Is that for example 'FS19Pink_preview.css' or do i have to add the path? I hope you can help. Kind regards, Jan Willem Vermeer |
Hi, i hope there is someone awake before the weekend :) I discovered that main.jsp is not used when i start my application. I can even delete the entire file main.jsp and everything keeps running normally. KR, JW Hi Jan-Willem,
That should not be possible. That would mean that the main.jsp is cashed somewhere.. (maybe a proxy server?)
(26 Oct '15, 15:03)
Michiel A
Hi Michiel, There is no caching, as far as i know... In the browser i see main.html and that is something else than main.jsp. So i guess there is "something" that creates the main.html page and as far as i can see, the main.jsp is not used in this process. Kind regards, Jan Willem
(26 Oct '15, 17:47)
Jan Willem V...
Hi Jan, main.jsp is one of the crucial parts of Formspider and it's impossible to run Formspider without it. What I see in your issue is, that, you're hitting a caching mechanism. If this is not the browser's then it is probably the tomcat's. To get over, please stop tomcat, remove [tomcat]/work directory and remove [tomcat]/conf/Catalina directory. Then restart tomcat. ( make sure that main.jsp is in place ) Best Regards
(27 Oct '15, 04:41)
Serdar ♦♦
|
Hi Serdar, This helped. My javascript is loaded now. So i have this: 1) Javascript
2) PLSQL
3) Offcourse the external method. But when i change the value in the combo box to change the color, nothing happens. I have added I guess Kind regards, Jan Willem Hi Jan-Willem, Try the method i put in the thread Yalim linked to: function changeCSS(cssFileName, cssLinkIndex) { var link = document.getElementsByTagName("link").item(cssLinkIndex); link.setAttribute("href", cssFileName); } that should work (see the explanation)
(27 Oct '15, 17:23)
Michiel A
Hi Jan, In your PLSQL procedure, theme names must not contain '_preview' suffix. For example, for default theme just us 'FS19Default.css' as file name. Regards, Serdar
(28 Oct '15, 04:26)
Serdar ♦♦
Hi Serdar, i have changed the names, verified that the javascript procedure receives the correct names, but nothing happens in the application. The style stays the same. I expected that the styling would change automatically, just like in the TEAM example. Kind regards, Jan Willem
(28 Oct '15, 04:41)
Jan Willem V...
|
Hi Michiel, I have studied your solution, but do not understand it cq do not know the link index. The html-source looks like this: I do not understand why all these "preview" stylesheets are loaded. I guess there must be a reason because the fs-team are clever guys. And even if this was ok, which file should be replaced? Kind regards, Jan Willem Hi Jan, Preview CSS files is used only in FormspiderIDE to preview panels. Browsers load them only once and then use it via their cache mechanism. Thus, these won't be an issue. Regards, Serdar
(28 Oct '15, 04:24)
Serdar ♦♦
|
YES, i got it working... With the html-inspector i noticed this: After copying the css files to my app folder, it worked. Now i am also beginning to understand Michiels solution... the chosen stylesheet is just loaded after the previous one so when users change the colorscheme 20 times, there are 20 "link" statements. Michiel - can you describe how to determine the cssLinkIndex in this case? Kind regards, Jan Willem Hi Jan-Willem, The trick is to not create a new link each time you change the theme, but change the existing one, so you should only need 1 linkindex, pointing to your default css. I personally use a more etensive js function, that also prevents the flickering you might see when changing theme.. I can send that if you are interested..
(28 Oct '15, 06:10)
Michiel A
Thanks Michiel, Sorry... a little bit complex for me. Do i understand it correctly that i have to replace the third stylesheet so: <link rel="styleheet" type="text/css" href="css/skins/FS19Default.css?v=1.9.0.build42"> So, with your script it should be linkindex 3. Is that right? I do not see any flickering... is that with a specific browser or o/s? Kind regards, Jan Willem
(28 Oct '15, 06:41)
Jan Willem V...
|
Hi, i have made this javascript to replace only the relevant stylesheet:
Kind regards, Jan Willem Hi Jan-Willem, Yep, that should work as well. Then every time the stylesheet is replaced, the same link index is replaced. Flickering probably does not appear because in this setup, all standard stylesheets are loaded into browser cache, so changing back will not require a new css load, so probablyy no visible flicker.
(28 Oct '15, 13:00)
Michiel A
|