Jeff Lynch

Forum Replies Created

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • in reply to: Require vLookup Values on New form #21884
    Jeff Lynch
    Participant

      On testing the validation does not work on a New Form because it always returns spjs.vLookup.dataObj as undefined in a new form. It works in the edit for so I will have to have the user click create and continue editing on New Form it appears.

      Is there a way to make it work on the new form? I would think it would be difficult.

      in reply to: Require vLookup Values on New form #21882
      Jeff Lynch
      Participant

        this works great. now they want multiple vLookups to be required, I’m thinking add it to the same function so like this…

        function dffs_PreSaveAction(){
        var hasChildren = false;
        var hasChildren1 = false;
        var hasChildren2 = false;

        if(spjs.vLookup.dataObj[“vLookupItems”] !== undefined && spjs.vLookup.dataObj[“vLookupItems”][spjs.dffs.data.thisItemID] !== undefined && spjs.vLookup.dataObj[“vLookupItems”][spjs.dffs.data.thisItemID].count > 0){
        hasChildren = true;
        }
        if(spjs.vLookup.dataObj[“vLookupW9”] !== undefined && spjs.vLookup.dataObj[“vLookupW9”][spjs.dffs.data.thisItemID] !== undefined && spjs.vLookup.dataObj[“vLookupW9”][spjs.dffs.data.thisItemID].count > 0){
        hasChildren1 = true;
        }
        if(spjs.vLookup.dataObj[“vLookupContract”] !== undefined && spjs.vLookup.dataObj[“vLookupContract”][spjs.dffs.data.thisItemID] !== undefined && spjs.vLookup.dataObj[“vLookupContract”][spjs.dffs.data.thisItemID].count > 0){
        hasChildren2 = true;
        }
        if(!hasChildren){
        alert(“You must add an Item to this request”);
        return false;
        }
        if(!hasChildren1){
        alert(“You must add the W9 to this request”);
        return false;
        }
        if(!hasChildren2){
        alert(“You must add the Contract to this request”);
        return false;
        }
        return true;

        }

        question is will it throw all three errors or just the first one with this…I’ll test and see.

        in reply to: Require vLookup Values on New form #21857
        Jeff Lynch
        Participant

          yes i did that, this was just the base code:

          function dffs_PreSaveAction(){
          var hasChildren = false;
          if(spjs.vLookup.dataObj[“vLookupItems”] !== undefined){
          hasChildren = true;
          }
          if(!hasChildren){
          alert(“You must add items before you can save the PRF!”);
          return false;
          }
          return true;
          }

          in reply to: Redirect from NewForm to EditForm in DFFS #19525
          Jeff Lynch
          Participant

            I am having a very hard time getting a lookup field to populate as an additional field.
            I’ve pulled it out in console.log and it is a string and it is populated with getFieldValue but i get a generic error “The operation failed because an unexpected error occured”.

            I pulled the value out and set it as a variable…same result here is my code, any ideas on how to populate a Lookup field?

            function saveAndRedir(){
            var ok = spjs.dffs.check_Mandatory([“Title”]), data = {}, newItem, url;
            var subcat = getFieldValue(“Sub_x0020_Category”);
            if(ok){
            data.Title = (“Title”);
            data.Sub_x0020_Category = subcat;

            newItem = spjs.utility.addItem({“listName”:_spPageContextInfo.pageListId,”data”:data});
            if(newItem.success){
            url = location.pathname.substring(0,location.pathname.lastIndexOf(“/”)) + “/EditForm.aspx?ID=”+newItem.id;
            if(GetUrlKeyValue(“IsDlg”)===”1″){
            url += “&IsDlg=1”;
            }
            location.href = url;
            }else{
            alert(newItem.errorText);
            }
            }
            }

            function PreSaveAction(){
            saveAndRedir();
            return false;
            }

            in reply to: Multiline Textfield Read-only #16638
            Jeff Lynch
            Participant

              I’m trying to implement this and it comes back as “undefined” what might I have missed here. We had issues with the field internal name because it had underscores that were converted to the code, before changing them we got a syntax error due to the field internal name, after changing it to underscores it just comes back as undefined.

              Here is the function:
              function appendHistory(){
              var history = $(“#dffs_Worklog_x0020_History”).find(“td.ms-formbody div.dffs_tdWrap div”).has(“a”).html();
              $(“#dffs_Worklog_x0020_History”).find(“td.dffs-readonly-inner div.dffs_tdWrap”).append(“”+history+””);
              }

              and here is the field internal name the way it appears: Worklog%5Fx0020%5FHistory

              again with the original field internal name we get a syntax error, and with the modified name we get “undefined”

              Jeff Lynch
              Participant

                one issue with the first part, if you open the display form first and then click the edit from there, it does not work, it appears the return path after the ID breaks it, any fix for that?

                in reply to: display lookup sub-field info on newform for read only use #15939
                Jeff Lynch
                Participant

                  this works great, is there a fast easy way to add a button to edit the parent list in a dialog box from the newform and editform?

                Viewing 7 posts - 16 through 22 (of 22 total)