# Changing stylesheet by using a selection list

**URL:** <https://www.ruby-forum.com/t/changing-stylesheet-by-using-a-selection-list/173751>\
**Category:** Rails\
**Created:** [August 14, 2009, 7:16am UTC](https://www.ruby-forum.com/t/changing-stylesheet-by-using-a-selection-list/173751 "2009-08-14T07:16:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdellaringa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7bcc69/32.png) [@tdellaringa](https://www.ruby-forum.com/u/tdellaringa)\
**Post date:** [August 14, 2009, 7:16am UTC](https://www.ruby-forum.com/t/changing-stylesheet-by-using-a-selection-list/173751/1 "2009-08-14T07:16:54Z")

</div>

Hey I can’t figure out how to change the stylesheet using a selection  
list. In my application I want to have an option for the user to change  
the look of the site by selecting a different layout from a list. All  
it would say is something like Layout 1, Layout 2, etc. and then it  
would change to the other layout. It isn’t necessary to do it via Ajax  
or javascript or whatever would be used there, but if you know how to do  
that, it would be even better. Thanks.

---

<div class="post-metadata">

**Author:** ![tdellaringa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7bcc69/32.png) [@tdellaringa](https://www.ruby-forum.com/u/tdellaringa)\
**Post date:** [August 14, 2009, 7:25am UTC](https://www.ruby-forum.com/t/changing-stylesheet-by-using-a-selection-list/173751/2 "2009-08-14T07:25:05Z")

</div>

Tom D. wrote:

> Hey I can’t figure out how to change the stylesheet using a selection  
> list. In my application I want to have an option for the user to change  
> the look of the site by selecting a different layout from a list. All  
> it would say is something like Layout 1, Layout 2, etc. and then it  
> would change to the other layout. It isn’t necessary to do it via Ajax  
> or javascript or whatever would be used there, but if you know how to do  
> that, it would be even better. Thanks.

1. Post on select changed
2. Save the selected value to session (select value is css file name)
3. stylesheet\_link\_tag use the session value.
