7 years ago
Topic

Hello there,

I tried, with no success,  to find in the forum a way to disable and hide  a group of fields in the site form of a user content-type.

Does It exist in Seblod? I tried with form tabs, but it do not work this way.

I need it to use in a site with four different user types, each one with a big set of custom fields. I need something like html fieldset, when I

disable It all fields inside will be disabled too.

I can disable necessary fields using jquery in a javascript field, but I think it is not an organized way to achieve It.

Thanks for any help!

Get a Book for SEBLOD
4229 Posts
Kadministrator
7 years ago
0
Level 1

If you use group field to insert a group of field from child content type, you can disable it using conditionals or restriction it and since all of the fields won't show. Otherwise you can set conditional on each field - or use some custom javascript.

7 years ago
0
Level 1

Thanks Klas,

I chose to use some custom javascript. I will let my solution if someone else need it:

1) Create a "start" and "end" Div field and put all group fields inside this Div.

2) Open the "start" Div field and put this code in "Custom Attributes":

id="my_div_id" style="display:none;"

3) Create a javascript field (seblod code pack) and put this code with your conditional:

jQuery(function($){
 var my_condition_var = $('#my_condition_field').val();
 $('#my_div_id *').attr("disabled", true); // Disables all fields inside the div to handle with eventual required fields
 
if (my_condition_var = 'some condition') { // This is the condition to show the Div with group of fields
           $('#my_div_id').show(); 
           $('#my_div_id *').attr("disabled", false); // enable all fields inside the div again
}

});

Of course you have to change the id and fields name to yours.

Get a VIP membership