Joomla 5 Notice

We are pleased to announce that as of January 29, 2024, all of our Joomla extensions are compatible with Joomla 5.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is now a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5!

Forum

Visforms Subscription user can ask questions in our forum. Please log in with the relevant user first.
Everybody can access the forum for reading.

Please only ask 1 question per topic.

Disabled attribute for fields

More
1 year 2 months ago #8915 by Oleg
Disabled attribute for fields was created by Oleg
Is it possible to set for fields attribute "disabled"?
I need to set that attribute for checkbox checked as default.

More
1 year 2 months ago #8922 by Administrator IV
Replied by Administrator IV on topic Disabled attribute for fields
Hello Oleg,

Visforms uses the 'disabled' attribute to control the conditional display of fields.
Setting this attribute from outside will almost certainly cause the form to stop working correctly.

Visforms builds a lot of logic on top of this attribute.
This includes, among other things, the display of the form, the validation of the data in the browser and in the server.

The attribute 'disabled' has the function in HTML to force that the value selected for the corresponding field is not sent with the post.
I'm pretty sure you don't want to prevent that.

Quote: I need to set that attribute for checkbox checked as default.
What do you actually want to achieve?
Maybe you want a "readonly"?

Greetings, Ingmar

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).

More
1 year 2 months ago #8923 by Oleg
Replied by Oleg on topic Disabled attribute for fields
Hello Ingmar,
thank you for your answer.

Quote: Maybe you want a "readonly"?
Yes, the "readonly" meets my requirements, but I don't find this option for checkbox. Is it possible?

More
1 year 2 months ago - 1 month 1 week ago #8925 by Administrator IV
Replied by Administrator IV on topic Disabled attribute for fields
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

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
Last edit: 1 month 1 week ago by Administrator IV.

More
1 year 2 months ago #8928 by Oleg
Replied by Oleg on topic Disabled attribute for fields
Hello Ingmar,
thank you for your detailed answer with interesting solution!

More
1 year 1 month ago #8954 by mojweb
Replied by mojweb on topic Disabled attribute for fields
+1 for read only on select fields.

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum