Skip to main content
Known Participant
June 13, 2025
Answered

Checkbox style

  • June 13, 2025
  • 1 reply
  • 415 views

Is there a way to change checkbox style with a script?

Correct answer Nesa Nurani

Yes, use something like this (it will cycle through check, cross, circle):

var f = this.getField("Check Box1");
var styles = [style.ch, style.cr, style.ci];
var currentIndex = styles.indexOf(f.style);
var nextIndex = (currentIndex + 1) % styles.length;

f.style = styles[nextIndex];

 

1 reply

Nesa Nurani
Community Expert
Community Expert
June 13, 2025

Yes, 
check - style.ch
cross - style.cr
diamond -  style.di
circle - style.ci
star - style.st
square - style.sq

You can use it like this:

this.getField("Check Box1").style = style.sq;

MarietaaAuthor
Known Participant
June 29, 2025

Thanks, I have an additional question, let's say I want to cycle through 3 styles with a button, is that possible?

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
June 29, 2025

Yes, use something like this (it will cycle through check, cross, circle):

var f = this.getField("Check Box1");
var styles = [style.ch, style.cr, style.ci];
var currentIndex = styles.indexOf(f.style);
var nextIndex = (currentIndex + 1) % styles.length;

f.style = styles[nextIndex];