Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



If you find this site useful and you want to support, buy me a coffee   to keep this site alive and without ads.

pill switch

Here is a simple way to create a pill switch without javascript. All you need is a calculated value that changes a boolean document property and some css to change the look and feel of it. The boolean doc property can then trigger another script when this property changes.

calculated value custom expression:
If(${myDocProp},"      ⚫","⚫      ") as [click to toggle]

The colors can be changed with the calculated values rules

html
<span class='pill'> calculated value goes here </span>

<style>
.pill {
 white-space:pre;
 border:1px solid #dfdfdf;
 cursor: pointer;
 background: #efefef;  
 border-radius: 100px;
}
</style>




2 comments:

AngloWelsh said...

Hi,

What rule did you put in place? I can't get the colour change to work.

Regards

Lee

Jose Leviaguirre said...

I set a color rule and copied the special character (including spaces) as per the calculated value.