Setting options for single choice

Hi, I'm trying to set the options for a single choice for a public form. I have these two variables outside of any functions:

var orgTypesCharitable = [
"501(c)(3) – Charitable Organizations: The most common type, covering religious, educational, charitable, scientific, or literary organizations, with tax-deductible donations. This category includes public charities (direct services) and private foundations (grant-making).",
"501(c)(4) – Social Welfare & Advocacy: Civic leagues or organizations promoting the common good, such as advocacy groups or homeowners' associations. They can engage in lobbying, but donations are generally not tax-deductible.",
"501(c)(5) – Labor & Agricultural: Groups for improving working conditions or agricultural/horticultural interests.",
"501(c)(6) – Business Leagues: Chambers of commerce, real estate boards, and professional associations.",
"501(c)(7) – Social Clubs: Organizations for pleasure or recreation, including hobby clubs.",
"501(c)(8) & 501(c)(10) – Fraternal Societies: Lodges providing member benefits or charitable support.",
"Not Known"
];
var orgTypesNonCharitable = [
"501(c)(4) – Social Welfare & Advocacy: Civic leagues or organizations promoting the common good, such as advocacy groups or homeowners' associations. They can engage in lobbying, but donations are generally not tax-deductible.",
"501(c)(5) – Labor & Agricultural: Groups for improving working conditions or agricultural/horticultural interests.",
"501(c)(6) – Business Leagues: Chambers of commerce, real estate boards, and professional associations.",
"501(c)(7) – Social Clubs: Organizations for pleasure or recreation, including hobby clubs.",
"501(c)(8) & 501(c)(10) – Fraternal Societies: Lodges providing member benefits or charitable support.",
"Not Known"
];

When a toggle is changed, a function is called that checks if the toggle is true. If so, then I set fd.field('NonProfitStatus').options = orgTypesCharitable;

else fd.field('NonProfitStatus').options = orgTypesNonCharitable;

The issue I am having is that when the toggle is not true, the console.log(fd.field('NonProfitStatus').options) shows the correct options, but the single choice doesn't reflect the changes. Any ideas on what could be going wrong? do I need a wait function somewhere?

In the screenshots, the console is showing what I want to be there, the single choice is showing an options for 501(c)(3) which I don't want, and missing an option for Not Known.

Hello @EHaya,

As I replied in the ticket, in your code, the styleLabels function rewrites the labels incorrectly. You need to either remove the function or rewrite it to change the options of the field correctly.