Skip Navigation

[Resolved] how to make checkboxes unselectable in toolset

This thread is resolved. Here is a description of the problem and solution.

Problem:

How to make checkboxes in a form unselectable?

Solution:

Add the JS code below:

jQuery('#cred_form_9608_1_1 input[type="checkbox"]').attr('disabled', 'disabled');

replace cred_form_9608_1_1 with the generated code for your instance.

Relevant Documentation:

https://toolset.com/course-lesson/adding-custom-javascript-to-views-templates-and-archives/

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.

This topic contains 18 replies, has 2 voices.

Last updated by opadipeO 1 year, 10 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2531553

Hello,
I added checkbox files to my form but I want to make it unselectable, how do I go about that? Like users should not be able to select the checkboxes

#2531691

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

If you give me the URL of the website I might be able to give you a Javascript code that you can add to disable it.

Usually, it should be something like this:

document.getElementById("checkBox").disabled=true;

Thanks.

#2531745

The url of the website is
hidden link
I also want all the checkbox to be selected at once when a user clicked on the select 'All' value.

#2531781

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

The link goes to the login page and I can not see the result.

I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.

Make sure you set the next reply as private.

#2531793

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

The link goes to the login page and I can not see the result.

I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.

Make sure you set the next reply as private.

Thanks

#2531905

Christopher Amirian
Supporter

Languages: English (English )

I managed to login bu I do not see any checkboxes. Would you please give me the URl of the exact Form that you used and have the checkboxes? Or maybe the custom Search?

Please give as many info as you can to avoid long back and forth

Thanks.

#2532509

Hello,
the name of the post form with checkboxes is Distribution form free (ID: 9948)
This can be found in toolset post forms

#2532657

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Ok I see the form but I do not know where it is used?

I need a front end URL that shows the checkboxes that you talk about so that I can check on my browser and see if I can suggest any sort of Javascript code to make the checkboxes show as disabled.

Then you can add that JS code to JS editor inside the form.

But now I do not know where you used that form. So I have no idea where to check to see the checkboxes in the front end.

#2532681

hello,

hidden link

#2532865

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

In the form that you added the checkboxes I added an attribute to the cred_field shortcode called readonly:

[cred_field field='distribute' force_type='field' class='form-check-input' output='bootstrap' readonly='true']

That will make the checkbox disabled/

But for some reason the front end of the website does not change. I even changed the button label and instead of "back" I added "back" but the front end does not change.

Would you please check and see if you have any sort of cache that prevents the front end to load the new content?

You can learn more about the cred_field shortcode attributes here:

https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_field

Thanks

#2533017

Hello,

I did clear the cache but i have the same issue the checkboxes are not disabled. readonly"true" worked for the text file when i added it to one of the foms

#2534769

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thanks I added the Javascript code below and now the checkboxes are all disabled:

jQuery('#cred_form_9608_1_1 input[type="checkbox"]').attr('disabled', 'disabled');

The Javascript code is added in the JS Editor section of the form.

Thanks.

#2535695

Hello,
I checked the js editor but did not see the js code in it?

#2536075

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Then please add the code I mentioned in the previous response to the JS Editor to see the effect.

Thanks.

#2536219

Hello,
The code worked and the checkbox is disabled but when i checked the js editor I did not see the code you added. So how come the checkbox was disabled if the code is not in the js editor?