Skip Navigation

[Resolved] How to automatically set checkbox or category based on value of checkboxes field

This support ticket is created 3 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by Minesh 3 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#2144701

We'd like your advice on how to do this and are open to changing the way things are organized: We have a bunch of types of curriculum - 100s of checkboxes broken out into 3 subjects: Math, ELA, and Science. Some are considered "standards-aligned" and others are not but there is currently no way to associated the standards-aligned ones with the standards-aligned checkbox. There is a post form where users can edit or add curriculum but they often don't know if they are standards-aligned so we would like to be able to automatically associate the curriculum with checking or unchecking the standards-aligned checkbox. Or, could automatically categorize them based on the curriculum checked. Since there are so many curriculum and they change with some frequency, it would be great if this was easy to maintain. There are already several layers of parent-child relationships so we are hesitant to add another. Is there a way to do this were we wouldn't have to call out each individual curriculum checkbox option in code?

hidden link
hidden link

#2145427

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I see with the reference URL you shared there is a checkbox "Standards-Aligned Material":
- hidden link

I'm not sure exactly yet what you want to achieve. Do you mean that you want to automatically set the checkbox "Standards-Aligned Material" checked when you submit the form? If no:
- Can you please share bit more details maybe few screenshot and the workflow that should help me to understand the issue first.

#2145737

Hi Minesh,

On this page hidden link I would like to remove the checkbox for "standards-aligned" from the post form but keep it as a field (or use a category--I'm open to ideas). Then if a user submits this form with, let's say, the subject Science > "Option title 1" selected then the "standards-aligned" checkbox would be automatically checked on the back-end based on that selection (because that curriculum is standards-aligned). If Science > "Option title 2" was selected it wouldn't be checked because that curriculum is not "standards-aligned". Right now there are only a few items under the subject curriculum but there will be 100s and I'd like a way to associate the items under each ELA, Math, and Science with being either "standards-aligned" or not so that users do not have to know this information when they submit the form and so that the admins do not have to check and correct submissions.

#2145775

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You can use the Toolset Form's hook: cred_before_save_data
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_before_save_data

Where you can set or unset the checkbox field value based on your conditional values.

Let me know if you need further help with that.

#2145865

Hi Minesh, I saw the cred_before_save_data option but it looks like this works best to say one value is selected so select another value. In our case there are 100s of options that could require checking the "standards-aligned" box and they will be changing with some frequency> I would like some advise on how to do this with many options and how to make it easy to maintain.

#2146293

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

There is no automatic way as you will have to write if condition for all possible combination where you will have to set the "standards-aligned" checkbox. So, lets say you have 100s of combinations you will have to write all those combination using if conditional and you have to optimize the code the best way.

As there is no such mechanism you will have to maintain the code and if conditional combinations and make sure you set the "standards-aligned" checkbox on right conditional statement where the if condition is satisfied.