# Question on application.overrideStyle()

**URL:** <https://forum.servoy.com/t/question-on-application-overridestyle/10187>\
**Category:** Classic Servoy\
**Created:** [January 26, 2009, 3:32pm UTC](https://forum.servoy.com/t/question-on-application-overridestyle/10187 "2009-01-26T15:32:18Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdcunha](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@jdcunha](https://forum.servoy.com/u/jdcunha)\
**Post date:** [January 26, 2009, 3:32pm UTC](https://forum.servoy.com/t/question-on-application-overridestyle/10187/1 "2009-01-26T15:32:18Z")

</div>

Hi,

Does application.overrideStyle() work with Web Client?

I just created a test solution where I am trying to override the style onOpen of the solution. It works in developer, but not in web client.

Please let me know if there is an alternate way of getting it to work in web client.

Regards  
jdcunha

---

<div class="post-metadata">

**Author:** ![Joas](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/joas/32/5095_2.png) [@Joas](https://forum.servoy.com/u/Joas)\
**Post date:** [January 28, 2009, 3:58pm UTC](https://forum.servoy.com/t/question-on-application-overridestyle/10187/2 "2009-01-28T15:58:25Z")

</div>

It should work.

If you experience otherwise, please create a case in the [Support system](http://crm.servoy.com/servoy-webclient/solutions/solution/servoy_support) and attach sample solution that reproduces the problem.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [February 11, 2009, 1:33pm UTC](https://forum.servoy.com/t/question-on-application-overridestyle/10187/3 "2009-02-11T13:33:18Z")

</div>

No in 3.5 this will not work and is not supported.  
it cant be fixed for 3.5 because that would require large code changes or backports from 4.1

Override style is currently fully supported from 4.1.1 on.

---

<div class="post-metadata">

**Author:** ![jdcunha](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@jdcunha](https://forum.servoy.com/u/jdcunha)\
**Post date:** [February 11, 2009, 1:53pm UTC](https://forum.servoy.com/t/question-on-application-overridestyle/10187/4 "2009-02-11T13:53:00Z")

</div>

Thanks Johan.

Regards  
James

---

<div class="post-metadata">

**Author:** ![martinh](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@martinh](https://forum.servoy.com/u/martinh)\
**Post date:** [March 20, 2009, 2:30pm UTC](https://forum.servoy.com/t/question-on-application-overridestyle/10187/5 "2009-03-20T14:30:35Z")

</div>

I want to use the overrideStyle in 4.1.1

Just the problem is that my style sheet is not predefined.  
I want to generate a style sheet depending on settings in my application.

This generated stylesheet must be stored in the database as a TEXT-field or stored as a style using application.getNewUUID() + ‘.css’ as a style but this must be done within script.  
The stylesheet will be regenerated several times, so styles must be updated as well by script.

Is there a away to do this?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [March 20, 2009, 2:47pm UTC](https://forum.servoy.com/t/question-on-application-overridestyle/10187/6 "2009-03-20T14:47:28Z")

</div>

there is no solutionmodel support for styles yet so what you want will not work.

Do remember if we would add support for altering or setting a style then that will only be reflected when forms are recreated and with a style  
you alter a lot of forms at once so all those if they are already shown will not be updated.

---

<div class="post-metadata">

**Author:** ![martinh](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@martinh](https://forum.servoy.com/u/martinh)\
**Post date:** [March 20, 2009, 2:54pm UTC](https://forum.servoy.com/t/question-on-application-overridestyle/10187/7 "2009-03-20T14:54:58Z")

</div>

Johan,

I would like to make some template stylesheet (template.css)  
On my forms I would like to link elements to this stylesheet

On runtime I would like to generate a stylesheet that will have the same contents as my template.  
And I thought after application.overrideStyle(‘template.css’, ‘xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx.css’) then the wanted stylesheet would be used.

I need this because I have a standard webshop, which is used for different companies and these companies can change their styles and colors themselves without the need of a developer.  
So the above sitiuation would be great to handle this

Would it be possible in the near future to add this functionality?

Shall I make a request or is there no chance that this will be implemented?

Martin

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [March 20, 2009, 3:05pm UTC](https://forum.servoy.com/t/question-on-application-overridestyle/10187/8 "2009-03-20T15:05:48Z")

</div>

yes make a case

we could make an extra method on solutionModel.createStyle(name,content)  
and after that you do overrideStyle

---

<div class="post-metadata">

**Author:** ![martinh](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@martinh](https://forum.servoy.com/u/martinh)\
**Post date:** [March 20, 2009, 3:16pm UTC](https://forum.servoy.com/t/question-on-application-overridestyle/10187/9 "2009-03-20T15:16:21Z")

</div>

Ok case 199743 was created

Perhaps a third parameter boolean OverwriteAllowed  
Because I need possibility to overwrite a previous generated stylesheet, but others will not like that  
If OverwriteAllowed = false, then createStyleSheet should return false if there is already a stylesheet with that name

I guess there will also be a method to delete a stylesheet?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [March 20, 2009, 3:34pm UTC](https://forum.servoy.com/t/question-on-application-overridestyle/10187/10 "2009-03-20T15:34:21Z")

</div>

why delete a style?

What is the used for that?  
Then all forms using that style are unresolved on the style properties?

also i was talking about newStyle(name,content)  
so if you do one with an existing name it will throw an exception.  
we could add a method setStyleContent(name,content) which updates an existing one. (and if you want to delete just use an empty content )

---

<div class="post-metadata">

**Author:** ![martinh](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@martinh](https://forum.servoy.com/u/martinh)\
**Post date:** [March 20, 2009, 3:47pm UTC](https://forum.servoy.com/t/question-on-application-overridestyle/10187/11 "2009-03-20T15:47:27Z")

</div>

> jcompagner:  
> why delete a style?
> 
> What is the used for that?  
> Then all forms using that style are unresolved on the style properties?
> 
> also i was talking about newStyle(name,content)  
> so if you do one with an existing name it will throw an exception.  
> we could add a method setStyleContent(name,content) which updates an existing one. (and if you want to delete just use an empty content )

These styles are for webshops. If a webshop is deleted then the corresponding style can be deleted also.  
And remember that my forms will link to the template stylesheet and not to the new generated style sheet.  
I hope the properties are not overwritten on the forms when I do application.overrideStyle()

Of couse my template style sheet will not be deleted. In that case you get unresolved of course.

setStyleContent(name,content) is good for updating.

And if I can test if a style exists, then I got all I need. I don’t like exceptions ![:-)]( "Smile")
