becca

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 42 total)
  • Author
    Posts
  • in reply to: Get Author (Created By) via JS #36072
    becca
    Participant

      nvm, found it in some of my ancient notes, if anyone else needs this solution it’s
      if (parseInt(spjs.dffs.beforeProperties.Author_ID)==parseInt(user.ID)){/*code*/}

      in reply to: Hide Content Type on DispForm #35872
      becca
      Participant

        in case anyone else is looking for this solution, based on what Alex provided I played around with it and jQuery(“tr[id=’dffs_ContentTypeChoice’]”).hide(); worked for me

        in reply to: API call in edit to show all open items by owner #28745
        becca
        Participant

          The jQuery.each isn’t working, I have that section copied exactly with an alert after the first { and it’s never reached

          Sorry, wasn’t paying enough attention to filters

          • This reply was modified 4 years, 10 months ago by becca.
          in reply to: API call in edit to show all open items by owner #28684
          becca
          Participant

            Thanks a ton, this thread has given me really good js notes.
            In case anyone in the future is searching for something similar here’s my code for displaying a count of open items per team member directly on the edit screen with an indicator for > 5 open items;

            
            
            function countItemsByStatus(arg) {
                var deferred = jQuery.Deferred();
                jQuery.ajax({
                    "url": _spPageContextInfo.webServerRelativeUrl + "/_api/web/lists/getbytitle('" + arg.listDisplayName + "')/items?$filter=Status eq 'In Progress' and Team eq 'B-Team' and " + arg.filterField + " eq '" + arg.value + "'",
                    "type": "GET",
                    "headers": {
                        "Accept": "application/json;odata=verbose",
                    },
                    "success": function (data) {
                        // Use console.log to see the data object
                        // console.log(data);
                        deferred.resolve(data);
                    },
                    "error": function (err) {
                        deferred.reject(err);
                    }
                });
                return deferred.promise();
            }
            
            countItemsByStatus({ "listDisplayName": "demo", "filterField": "OwnerId", "value": "10" }).done(function (data) {
                document.getElementById("tom").innerHTML = data.d.results.length;
                if (data.d.results.length > 5) {
                    document.getElementById("tom").style = "color:red";
                }
            }).fail(function (err) {
                alert(JSON.stringify(err));
            });

            Where “tom” refers to a <span> in a table in an HTML section in the tab. The countItemByStatus is repeated for each team member, but I’m sure someone could leverage the previous comments to cycle through all instead.

            in reply to: API call in edit to show all open items by owner #28663
            becca
            Participant

              Just got a different scenario, is there a way to get a sum of all the values in a field across multiple items? So instead of count of everything filtered, sum of all values of a certain field for everything filtered. Was originally going to be all open items per team member but now it may change to total story points per team member and I’m not sure how to change the inside of countItemByStatus for that.

              in reply to: API call in edit to show all open items by owner #28650
              becca
              Participant

                This is perfect, I added additional filters that will always be true to the initial url. Now I just need to put the variable out and use it to feed a html section. This is great and helps our form a ton, thank you!

                in reply to: Js hide Edit button on Display #28579
                becca
                Participant

                  A setTimeout worked, thanks!

                  For anyone else looking for this solution,

                  setTimeout(function() { document.querySelector("#dffs_editItemBtn").style.display="none"; }, 1050);

                  Any less than 1050 the button flickers on the screen and any more this code runs before the edit button is added

                  in reply to: Code throwing errors selectively #26720
                  becca
                  Participant

                    Side effect of being new to js and getting references from multiple different sources is code not being designed cohesively, I’ll clean up my code using this and let you know if I’m still getting errors. Thanks a ton 🙂

                    in reply to: spjs.dffs.dlgBox #26124
                    becca
                    Participant

                      Got it, I moved one bracket out of place. Oh the joys of coding, one character off but not in an error-throwing way can cause so much headache. This works, now just to add this button press to my redirection navigation exceptions and I’m done with this story.

                      Thanks for getting my morning off to a good start.

                      in reply to: spjs.dffs.dlgBox #26109
                      becca
                      Participant

                        I think the issue is the return false in the PreSaveAction, since other events in the PreSaveAction are running before getting caught on that line. Seems like bad practice. What I’m going to try next is replace the Submit button with a matching clone that triggers the dlg if needed or goes straight to triggerSave otherwise, and see if putting a triggerSave in the dlg btnOK works that way.

                        in reply to: spjs.dffs.dlgBox #26107
                        becca
                        Participant

                          No dice, didn’t change a thing

                          in reply to: spjs.dffs.dlgBox #26086
                          becca
                          Participant

                            I have the misc tab set to give me the yellow notification bar for missed required fields and I double checked my js for the only changes made with this addition so that’s not the problem. If it was I wouldn’t get to PreSaveAction in the first place.

                            On load

                            Resource interpreted as Document but transferred with MIME type
                            clienttemplates.js?r…jz4PK%2FeWg%3D%3D:1 image/gif: “http://sharepoint4.company.com/_layouts/15/images/blank.gif?rev=23&#8221;

                            Resource interpreted as Document but transferred with MIME type image/gif: “http://sharepoint4.company.com/_layouts/15/images/blank.gif?rev=38&#8221;

                            With both jquery.js:3 and jquery.js:4

                            [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience.

                            With jquery.js:4

                            and nothing new when I save

                            in reply to: spjs.dffs.dlgBox #26075
                            becca
                            Participant

                              I’ve swapped a few different save attempts in and none have worked and returned so far.

                              
                              
                              function customCloseFunc() {
                                  var inff = $("#info").val(); var houu = $("#hours").val();
                                  if (inff !== "" && houu !== ""){
                                      setFieldValue('field1', inff); setFieldValue('field2', houu);
                                      spjs.dffs.closeDlg();
                                      alrtOKd = true;
                                      spjs.dffs.processEmailTemplate("email"); //this does run
                                      //jQspjs("input[id$='diidIOSaveItem']:last").trigger("click");
                                      //$("input[id$='diidIOSaveItem']:last").trigger("click");
                                      //spjs.dffs.triggerSave();
                                      //return true;
                                  }
                                  else{
                                      if (inff === ""){$("#formVal1").show();}else{$("#formVal1").hide();}
                                      if (houu === ""){$("#formVal2").show();}else{$("#formVal2").hide();}
                                  }
                              }
                              
                              var alrtOKd = false;
                              function PreSaveAction() {
                                  //
                                  //just a whole bunch of other checks and emails
                                  //
                                  if (getFieldValue('Complete') === true){
                                      if (!alrtOKd){
                                          spjs.dffs.alert({
                                              "title":"blah",
                                              "msg":"important parts are <textarea id='info></textarea> <div id='formVal1'> <input type='number'> <div id='formVal2'> <input type='button' class='spjs-dlg-btnOK' onclick='customCloseFunc' value='Save'> <input type='button' class='spjs-dlg-cancelOK' onclick='spjs.dffs.closeDlg();' value='Cancel Save'>",
                                              "noBtn":true
                                          });
                                      }
                                      return false;
                                  }
                                  return true;
                              }

                              Everything else works correctly, just the save and return will not happen.
                              *sorry for all the edits, coding in vba too so I kept using ‘ instead of // and messing everything up

                              • This reply was modified 5 years, 5 months ago by becca.
                              • This reply was modified 5 years, 5 months ago by becca.
                              • This reply was modified 5 years, 5 months ago by becca.
                              in reply to: spjs.dffs.dlgBox #26073
                              becca
                              Participant

                                Updated to the most recent version and it still is not working

                                in reply to: Get ID on New Item Save #26063
                                becca
                                Participant

                                  So not sure what is up with this right now, when I last responded it took me directly to the item but now both view and edit are taking me to a list view filtered to only the item, or all items with the same name. I tried this on 2 separate sites and they’re both taking me to a list view now for links from new items, did I mess something up?

                                Viewing 15 posts - 1 through 15 (of 42 total)