Skip Navigation

[Resolved] Retrieving value from chechbox

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 8 replies, has 2 voices.

Last updated by Minesh 1 year, 1 month ago.

Assisted by: Minesh.

Author
Posts
#2672253
Live website.jpg
JS 2.jpg
JS 1.jpg
Filtering page.jpg
Custom filter block.jpg

I am trying to replace checkboxes from custom filter with buttons so it is more aesthetically pleasing, using javascript i have created buttons that replace each checkboxes. Buttons are working(when button is pressed checkbox is checked)
However, i am having trouble retrieving value %%COUNT%% from custom search filter.
I have managed to hide checkbox with CSS code:
input[type="checkbox"] {
display: none;
}
But dont know code to hide label from those checkboxes.
I am providing you with pictures of everything so it should be easier to understand.

#2672459

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

If you can check with the following screenshot you shared - on right sidebar you can see the section "FORMAT OF THE OPTIONS" from that section you should only set to display %%NAME%% and remove the (%%COUNT%%)
-https://toolset.com/wp-content/uploads/2023/12/2672253-Custom_filter_block.jpg

#2672739
Desired button.jpg

That would remove that number completely, i want to access that number in javascript so i can add it to button label like in the picture i uploaded

#2672869

Minesh
Supporter

Languages: English (English )

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

Can you please share problem URL and admin access details and let me review and check if I able to find any possible workaround.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2672939

Minesh
Supporter

Languages: English (English )

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

It seems you forget to share the problem URL. Can you please share problem URL where I can see the view with filters you added.

#2673113

Oh, sorry...

page url: hidden link
content template: hidden link

#2673157

Minesh
Supporter

Languages: English (English )

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

I see you added the button in the custom search field filter setting as:

<button>%%NAME%% (%%COUNT%%)</button>

Can you please tell me now what JS you want to apply and what exactly your requirement and where you added the said custom Javascript code?

#2673185
JS editor in Content Template.jpg
Block of that section.jpg

adding button in the section "FORMAT OF THE OPTIONS" does not work, when i click checkbox is not checked, so i removed it now so there is no confusion.
Instead those buttons should be created in javascript, I added custom javascript code in the JS editor of that template.
I am providing you with picture of js editor.
In that js code i am able to retrieve value from checkbox and create buttons that work, but i cant retrieve (%%COUNT%%) value and add it as well as the value box(in my case i am able to retrieve Indica,Sativa,Hybrid but not (45),(104),(51)).

#2673221

Minesh
Supporter

Languages: English (English )

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

I got it now what you want and there is no easy way to achieve this.

You may need to add more custom JS code in order to get the count value. Count value is added as label text so you will have to split the label text with maybe ( (bracket symbol) and try to get the closest label and based on that closest label test you should try to get the label text and split the label text with ( bracket and get the count.

This is just idea if you have better solution with JS you should go with that. Unfortunately - to help with such custom javascript edits is beyond the scope of our support policy. If you need further help for such custom programming you are welcome to contact any of our certified partner:
- https://toolset.com/contractors/