You are viewing limited content. For full access, please sign in.

Question

Question

Collection or Table Field

asked on November 15, 2020

Hi Everyone,

I'm hoping you can help me regarding to this matter.

How to disable the delete and check, clear button on the previous comment of the submitter? But when the new submitter click/select the add button to have a new table/collection of field, the check, clear button must be enable. 

Please see the image.

Thank you.

0 0

Replies

replied on November 16, 2020

For the collection options you can set it to “Append sets to the sets populated by a data source o variable" and set min to "0" and max as empty.

With this option the sets added in previous steps will not allow delete and user can only delete the new sets added at the current step. And can also set the fields in the sets added in previous steps to be read-only with the option "Previous data or new lookup data will be read-only, but user-added sets will be editable".

In your JavaScript you can check whether the fields are read-only or not to decide whether the enable/disable the check all/clear all buttons.

 

0 0
replied on November 16, 2020 Show version history

Hi Xiuhong,

 

Thank you for responding to my concern.

How to do your suggestion about the JavaScript of check all/clear all buttons?

Thank you

0 0
replied on November 22, 2020

You can refer to script as following:

$(document).ready(function(){
//get each set of collection
  $('.cf-collection ul').each(function()
                               {
                                 var objSet = $(this);
//find a target field that should be read-only
                                 if(objSet.find('.targetfield input').attr('readonly')=='readonly'){
//set the Check All Button as disabled when the field is read-only                          
                                   objSet.find('.CheckAll').prop('disabled',true);
                               }
                               })
                               });

I added CSS class "targetfield" and "CheckAll" to the target field and the Check All button.

0 0
replied on November 22, 2020

Hi Xiuhong,

 

Thank you for the script, I will try this.

 

Thanks

0 0
replied on November 23, 2020

Hi Xiuhong,

 

Sorry but I'm not a programmer, can you check this code if it's right.

Because I try your code but the button (check All/clear All) still functioning, don't turn to read only. Please check the code.

Code: 

$(document).ready(function(){
//get each set of collection
  $('.cf-collection ul').each(function()
                               {
                                 var objSet = $(this);
//find a target field that should be read-only
                                 if(objSet.find('.setcheckbox input').attr('readonly')=='readonly'){
//set the Check All Button as disabled when the field is read-only                          
                                   objSet.find('.CheckClearAll').prop('disabled',true);
                                 
}
})
});
                                 
function checkAll() {

  $('.setcheckbox input').prop('checked', true);

}

function clearAll() {

  $('.setcheckbox input').prop('checked', false);

}

Thanks

0 0
replied on November 23, 2020

It is because there are multiple inputs for a checkbox field, you need to use following line "objSet.find('.setcheckbox input:first').attr('readonly')=='readonly'" to replace "objSet.find('.setcheckbox input').attr('readonly')=='readonly'".

0 0
replied on November 23, 2020 Show version history

After the submission of the form and do what you instructed, I already change the code like what you say. But the HTML field where the Check All and Clear All buttons created still functional.

 

Thanks

0 0
replied on December 16, 2020

Hi Xiuhong,

 

Any update about the HTML button that functions clear/check all.

As I said, I try your code but the button still functioning.

 

Hoping you can help me with this.

 

Thank you

0 0
replied on January 11, 2021

Xiuhong,

 

Happy New Year, may I know if this had an update or a complete/working CSS/Java Code?

 

Thanks

 

Hopping for you're responds.

0 0
replied on January 21, 2021

Hi Rafael,

 

Here is the code :
$(document).ready(function(){
//get each set of collection
  $('.cf-collection ul').each(function()
                               {
                                 var objSet = $(this);
//find a target field that should be read-only
                                 if(objSet.find('.setcheckbox input:first').attr('readonly')=='readonly'){
//set the Check All Button as disabled when the field is read-only                          
                                   objSet.find('.CheckClearAll button').attr('disabled',true);
                                 
}
})
});

 

Please check if that works for you this time.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.