Build in CheckOut function – how to… ?

Home Forums Classic DFFS Build in CheckOut function – how to… ?

Viewing 4 reply threads
  • Author
    Posts
    • #17779
      Artaker
      Participant

        Hi!

        I’m really thankful for this build in checkout function, though there are two things my client asked about and I’m not sure how to do this (without messing with the function)

        1. Is there a possiblitly to remove the Keep checked out after saving checkbox? (see the pic) My client doesn’t want this option available for the users.
        I deleted the lable text but the checkbox is still there.

        2. Is it possible to check in the item (or undo the checkout) if the edit mode is left through the cancel button and not saved? As it is now, only the save button does checkin the item again 🙁

        Thanks

        BR,
        Nicole

        Attachments:
      • #17786
        Artaker
        Participant

          Forgot to add the Verion info

        • #17895
          Michael
          Participant

            Hi,
            we have excactly the same requirment.

            This is the solution we use:

            Custom JS:

            $(window).bind("beforeunload",function(event) {
            	if(dffs_beforeunload){
            		var res = spjs_updateItem({"listName":"MYDFFSLIST","id":GetUrlKeyValue("ID"),"data":{"CheckedOut":"0"}});
            		if(res.success){
            			// success
            		}else{
            //error
            		}
            	}
            });

            Custom CSS:

            .dffs_checkInOnSave{
                display: none;
            }

            I hope this helps. Maybe there is a better solution for this..

            Regards,
            Michael

            • This reply was modified 7 years, 4 months ago by Michael.
          • #17913
            Alexander Bautz
            Keymaster

              Sorry for the late reply.
              #1:
              This can be done with CSS only. Add this to your forms Custom CSS:

              .dffs_checkInOnSave input{
                  display:none;
              }

              I’ll fix it in the next version so that clearing the label will hide the checkbox.

              #2:
              It’s hard to catch the “beforeunload” in a consistent way cross browser and in both dialogs and in normal pages. I’ll try to fix this in the next version, but in the meantime you can test this in the Custom JS in your EditForm:

              // Hide cancel button in ribbon
              jQspjs("#Ribbon\\.ListForm\\.Edit\\.Commit\\.Cancel-Large").hide();
              if(isDlg){
              	// Hide close dlg button
              	jQspjs(window.parent.document).find(".ms-dlgCloseBtn").remove();
              }
              jQspjs("input[id$=diidIOGoBack]").click(function(){
              	toggleCheckOut("0");
              	if(isDlg){
              		window.frameElement.cancelPopUp();
              	}else{
              		var rUrl = jQspjs("input[id$=diidIOGoBack]:first").attr("onclick").match(/\(\'([^)]+)\'\)/)[1].split("\\u002f").join("/");
              		STSNavigate(rUrl);
              	}
              });
              
              function = toggleCheckOut:(a){
              	var res = spjs.utility.updateItem({"listName":_spPageContextInfo.pageListId,"id":spjs.dffs.data.thisItemID,"data":{"CheckedOut":a}});
              	if(res.success){
              		location.href = location.href;
              	}else{
              		alert(res.errorText);
              		spjs.dffs.chkOut.toDispForm();
              	}
              };

              Please note that this is tested in SP 2013 / SPO only – not in SP 2010.

              Alexander

              • #18056
                Artaker
                Participant

                  Hi Alexander!

                  Thanks for the input.
                  The CSS worked perfectly (of cause), thanks

                  As for the #2 script: I get an load error and am unable to debug since it won’t even load with the F12 debugging console present. The problem seems to be the “jQspjs” function.
                  Does it have to beloaded separately? Is it not included in my version? Or is this another problem with the template, which is a calendar.

                  Thanks

                  Best regards,
                  Nicole

              • #18060
                Alexander Bautz
                Keymaster

                  My bad – the jQspjs namespace is used only in later versions – just change it to jQuery.

                  Alexander

              Viewing 4 reply threads
              • You must be logged in to reply to this topic.