Skip Navigation

[Resolved] How to add a checkbox

This support ticket is created 4 years, 4 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)

Tagged: 

This topic contains 12 replies, has 2 voices.

Last updated by nickW-7 4 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#1976075
Screen Shot 2021-03-05 at 11.13.19 AM.png

Tell us what you are trying to do?
I currently have a radio button for the 'Family Friendly' filter with "yes" and "no" as an option. I would like it to be a checkbox instead and only have "yes" as an option.

This is my current view:
[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-groups">
<div class="form-group">
<label>[wpml-string context="wpv-views"]Location[/wpml-string]</label>
[wpv-control-post-taxonomy taxonomy="groups_area" type="select" default_label="All" format="%%NAME%% (%%COUNT%%)" url_param="wpv-groups_area"]
</div>
<div class="form-group">
<label>[wpml-string context="wpv-views"]Physical Demand[/wpml-string]</label>
[wpv-control-postmeta field="wpcf-renew-physical-demands" type="select" default_label="All" url_param="wpv-wpcf-renew-physical-demands"]
</div>

<div class="form-group">
<label>[wpml-string context="wpv-views"]Family Friendly[/wpml-string]</label>
[wpv-control-post-taxonomy taxonomy="groups_childcare" type="radios" url_param="wpv-groups_childcare"]
</div>

</div>

[wpv-filter-end]

Is there any documentation that you are following?
See photo mockup

Is there a similar example that we can see?
See photo mockup

What is the link to your site?
hidden link

#1976281

Shane
Supporter

Languages: English (English )

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

Hi Nick,

Thank you for getting in touch.
I currently have a radio button for the 'Family Friendly' filter with "yes" and "no" as an option. I would like it to be a checkbox instead and only have "yes" as an option.

You say you have a radio button with yes and no. Is it a Radio button group ? Or were they created as single Radio buttons where yes and no are separate custom fields.

Can you send me a screenshot of the custom field on the backend under the custom field group settings In toolset->Custom Fields.

Thanks,
Shane

#1983019
Unknown-1.png

Hello Shane,

‘groups_childcare’ (Family Friendly) is a taxonomy, not a custom filed. I’m not sure if it’s a group or singles. Where can I check that?
I’m pulling ‘groups_childcare’ from a database API that stores this information.

This is the only custom filed I created for this post type:

#1983029
Unknown.png

Hello,

‘groups_childcare’ (Family Friendly) is a taxonomy not a custom filed. I’m not sure if it’s a group or singles. Where can I check that?
I’m pulling ‘groups_childcare’ from a database API that stores this information.

This is the only custom filed I created for this post type:

#1983701

Shane
Supporter

Languages: English (English )

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

Hi Nick,

Would you mind allowing me to have admin access to the website so that I can have a look ?

Also please let me know the link to the page where I can have a look at the view.

The private fields have been enabled for your next response.

Thanks,
Shane

#1983971

Shane
Supporter

Languages: English (English )

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

Hi Nick,

Can you provide the information that I will need to add to my host files to access the page ?

I've enabled the private fields once more.

Thanks,
Shane

#1983983

Add:

#1984207

Shane
Supporter

Languages: English (English )

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

Hi Nick,

I wasn't successful in accessing the site using the info you sent previously, however to change the filter to a checkbox, add the following to your filter type="checkboxes" right now it is type= "radio"

Secondly to remove the No Option you will need to hide this with css because for taxonomy you're not able to manually define the options.

When you've changed the option to checkboxes then you can send me a link to the live site page and I will provide you with the CSS to hide the No option.
Thanks,
Shane

#1988153

Ok, thanks. I was able to convert it to a checkbox and I'm ready for the CSS to hide the 'no' option. hidden link

#1988221

Shane
Supporter

Languages: English (English )

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

Hi Nick,

Here is the css to hide the No field

#groups_childcare-no{
display:none !important;
}
.form-check-label[for="groups_childcare-no"]{
display: none !important;
}

This should work now.

Thanks,
Shane

#1988285

That worked, thanks. Last thing is how can I bring the checkbox closer to the "Yes". There is too much space between them.

#1989161

Shane
Supporter

Languages: English (English )

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

Hi Nick,

You can adjust the width attribute with the css below.

#groups_childcare-yes{
width: 50% !important;
}

If there is anything else please let me know.

Thanks,
Shane

#1989199

My issue is resolved now. Thank you!