You are viewing limited content. For full access, please sign in.

Question

Question

Change Theme with Javascript or Lookup Value?

asked on October 5, 2016 Show version history

Is there a way to change the theme based on a variable passed through the url?  As in something like a link "forms.website.com/Forms/GenericForm?ClientID=CompanyXYZ" using the ClientID to change out the theme? 

We have a number of generic public forms that will need branded for a substantial number of clients and I'm looking for ways to do that outside of having to duplicate and publish each form for each variation individually.  Setting one theme per client and calling that on the forms as needed seems like it'd be a lot less repetitive, plus avoids having several hundred active forms to wade through. 

Alternative suggestions are welcome!

0 0

Replies

replied on October 5, 2016

This is not easy to do. Forms stores your Themes in the database, and when it loads a Form, it basically injects the theme (as an inline CSS stylesheet) into the page on the server side. There is no simple variable or query string parameter you can pass in to change it. You would have to create your own set of themes such that your new rules override the ones that are built in. (OR perhaps you could put some kind of DB lookup on your form that references the cf_theme table in the Forms database, and then read the CSS/JSON out of that and apply it to your form after everything else has loaded?)

1 0
replied on October 5, 2016

Storing the replacement CSS in a DB and using a lookup rule to pull it was kind of what I was thinking might be necessary.  Well, I'll see what I can manage!  Thanks for the info! 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.