Hello Oleg,
'readonly' is not supported by the HTML.
In HTML there is no 'readonly' for checkbox, multi-checkbox and select controls.
For slightly different reasons.
Therefore it is not yet supported in Visforms.
However, there is a way for you to still achieve it with very little JavaScript.
You need a script element with very few lines of JavaScript where you display the form.
You can have the script element loaded on top of your form using a site module of type 'custom'.
Create the site module of type 'custom':
Set parameter 'Title' = 'Hide'.
vi-solutions.de/forum-uploads/add-script...rm_module-module.png
Also select a suitable module position there.
The module position must be present where your form appears.
For me this is the case with the template 'Cassiopeia' as follows:
Parameter 'position' = 'banner'.
Add the following script element with the small JavaScript as the content of the module:
Change the fixed value for the field ID '121' to the current value of your checkbox field.
Code:
<script>
jQuery(document).ready(function() {
//console.log('called');
jQuery("#field121").click(function() { return false; });
});
</script>
The commented-out line may help to see in the web-browsers development tools if the script gets loaded.
On the 'Menu Assignment' tab, select only the menu you use to display the form:
Set parameter 'Module Assignment' = 'Only on the pages selected'.
vi-solutions.de/forum-uploads/add-script..._module-advanced.png
On the 'Advanced' tab, make sure that only the most necessary HTML is generated (no frames or other DIV elements):
Set parameter 'Module Style' = 'none'.
vi-solutions.de/forum-uploads/add-script...-menu-assignment.png
Your checkbox can then no longer be changed by the user.
However, the value of the checkbox is sent when the form is sent.
Unfortunately, there isn't a section in the documentation yet about what I've described here.
In other words, how a module can be used to load your own JavaScript specifically for a form.
But I think it belongs there.
I have created a development issue for the documentation wish list:
Issue [VF-715] Docu: Add Section: How to add custom HTML script element to a form using a module
If we have expanded the documentation, you will be explicitly informed about it here in the topic.
We want to take a closer look at the 'readonly' again.
Maybe we can integrate your solution into Visforms in general.
However, we cannot yet foresee whether it will not have unexpected and nasty side effects.
There really is a lot of functionality and existing JavaScript code in this area.
So I can't promise it.
I assume that your form doesn't use everything that Visforms offers.
So it should work for you without any problems.
I have created a development issue for the feature wish list:
Issue [VF-714] Forum: Checkbox: Show like 'readonly' but without disabling it
When we release the new feature, you will be explicitly informed about the release here in the topic.
Thank you again for your contribution!
Kind regards, Ingmar