Rad

Forum Replies Created

Viewing 2 posts - 46 through 47 (of 47 total)
  • Author
    Posts
  • in reply to: Easy way to make all fields readonly? #37745
    Rad
    Participant

      using this :

      function setTabToReadOnly(tabIdx){
      console.log(“function: setTabToReadOnly: ” + tabIdx);
      var arrToSetReadonly = [];
      //jQuery.each(spjs.dffs.data.tabFieldsObj,function(fin,o){
      jQuery.each(spjs.dffs.data.tabConfigObj[tabIdx].fields,function(i,fin){

      arrToSetReadonly.push(fin);
      });

      spjs.dffs.doReadOnly(arrToSetReadonly);
      spjs.dffs.toggleSaveBtnByRule(false); /* hide save button */
      }

      in reply to: Easy way to make all fields readonly? #37743
      Rad
      Participant

        Hi, I am trying to use the below code to make all the fields in Tab0 (I’ve 2 tabs and one should be read only based on access level) read only and noticing couple of things:

        1. it doesn’t seem to work for all the fields. Some fields still show as editable. What could be the issue?

        2. The multiselect checkboxes all align in one column (using function multichoiceVertical -see below to align checkboxes horizontally) but calling setTabToReadOnly is removes the format

        function setTabToReadOnly(tabIdx){
        console.log(“function: setTabToReadOnly: ” + tabIdx);
        var arrToSetReadonly = [];
        jQuery.each(spjs.dffs.data.tabFieldsObj,function(fin,o){
        // jQuery.each(spjs.dffs.data.tabConfigObj[tabIdx].fields,function(i,fin){

        arrToSetReadonly.push(fin);
        });

        spjs.dffs.doReadOnly(arrToSetReadonly);
        spjs.dffs.toggleSaveBtnByRule(false); /* hide save button */
        }

        function multichoiceVertical(arr,breakAfter){
        var toFind, index, counter, table;
        toFind = “td.ms-formbody”;
        if($(“td.ms-formbodysurvey”).length>0){
        toFind = “td.ms-formbodysurvey”;
        }
        $.each(arr,function(i,fin){
        if(fields[fin]!==undefined){
        index = 0;
        counter = 0;
        table = $(fields[fin]).find(toFind+’ table:first’);
        $(table).prepend(“<tr id=’vertical_”+fin+”_”+index+”‘></tr>”);
        $(table).find(‘tr:first’).nextAll().each(function(){
        if(counter%breakAfter===0){
        $(“#vertical_”+fin+”_”+index).after(“<tr id=’vertical_”+fin+”_”+(index+1)+”‘></tr>”);
        index += 1;
        }
        $(this).find(‘td:first’).appendTo($(“#vertical_”+fin+”_”+index));
        $(this).remove();
        counter += 1;
        });
        }
        });
        }

        • This reply was modified 6 months, 3 weeks ago by Rad.
      Viewing 2 posts - 46 through 47 (of 47 total)