Skip Navigation

[Resolved] Checkbox are checked by default in users CRED

This support ticket is created 6 years, 9 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 10 replies, has 2 voices.

Last updated by marcoR-6 6 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#541484

Hi,
I have a problem with the users CRED modify form. I have a checkbox field and appear always checked. I would that the checkbox is checked when the value is 0 and the checkbox not checked when value is 1. This checkbox field is a custom user field.

In short, I have to set the default value in the opposite way that the value is stored in database.

How can I do that?

Thank you

#541596

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Marco,

Thank you for contacting our support forum.

I'm not sure what you mean but this is my interpretation. Is it that you want this checkbox to not be checked by default and when it is not checked the value is set to 1 and when it is checked the value set to 0?

Please let me know.
Thanks,
Shane

#542319

Hi Shane,
I have to modify value of the checkbox without touch it. For example I have a field that is called "status". If status value is set 1 in db, I have to see the checkbox unchecked, if the value of status is 0, I have to see checkbox checked.

#542530

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Marco,

Im not sure why you're reversing the roles of the values. Is there a particular reasoning for doing this ?

Maybe in understanding the reason behind this setup I can understand what you are trying to achieve.

Thanks,
Shane

#542862

I have a list of users, and every user have a custom field (checkbox). I have to change this checkbox value only with a click.

So the checkbox is not shown. To change value, I need that the checkbox have the opposite value as default.

#543086

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Marco,

So this custom field is hidden from the users? And you want to change the value being checked or not checked through the database correct?

In evaluating it though the frontend using 1 or 0 shouldn't matter its just what you represent as check and uncheck. So lets say you want all the customers who don't have the checkbox checked.

Not checked is represented by 1 and if you set the filters to display all the users with 1.

Please let me know if you are clear on what i'm saying.

Thanks,
Shane

#543335

I write an example:

[x] = checked
[ ]= unchecked

- USER 1 [x]custom_field [SAVE]
- USER 2 [ ]custom_field [SAVE]
- USER 3 [ ]custom_field [SAVE]
- USER 4 [ ]custom_field [SAVE]
- USER 5 [x]custom_field [SAVE]
- USER 6 [ ]custom_field [SAVE]
- USER 7 [x]custom_field [SAVE]

[x] is when value on db is set to 0, so if I click on "SAVE" button the value is change to 1
[ ] is when value on db is set to 1, so if I click on "SAVE" button the value is change to 0

#543515

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Marco,

So the simple solution is to reverse the values.

Can i see a screenshot of the Custom field edit page on the backend to see what the values being written to the database is.

Thanks,
Shane

#544167
Schermata 2017-07-03 alle 09.41.09.png

Hi Shane,
I attach a screenshot.

#544439

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Marco,

Thank you for the patience, I discussed this with a colleague and the best plan of action is to use a different field type.

Using a numeric field would allow you to perform the changing of the value and we found that using a checkbox will be a bit complex.

Is there a reason for the use of the checkbox?

Please let me know.
Thanks,
Shane

#545081

Ok, I use another field type. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.