Alexander Bautz

Forum Replies Created

Viewing 15 posts - 256 through 270 (of 4,705 total)
  • Author
    Posts
  • in reply to: Autocomplete Issue #37165
    Alexander Bautz
    Keymaster

      I think the problem is the default delimiter for multiple values. It is by default “;\r\n”, but this format causes problems.

      Try invoking the cascading dropdown manually as described in the user manual here: https://spjsblog.com/dffs/dffs-plugins/spjs-cascading-dropdowns/#Invoke_the_function_manually

      and use

      "multichoiceDelimiter": ";" + String.fromCharCode(10)
      

      See if that helps.

      Alexander

      in reply to: CommentBox Basics #37162
      Alexander Bautz
      Keymaster

        1: There is a bug in the code that strips away the ID from the URL. To fix it you can add this to your custom js:

        spjs.cBox.doneUnsubscribe =  function (iID, id) {
            delete spjs.cBox.data.mySubscriptions[iID][id];
            if (id !== "0") {
                jQuery("#subscriptionLink_" + iID + "_" + id).removeClass("cBox-Icon-RingerRemove").addClass("cBox-Icon-Ringer");
            } else {
                jQuery("#subscriptionLink_" + iID).removeClass("cBox-Icon-RingerRemoveLarge").addClass("cBox-Icon-RingerLarge");
            }
            spjs.cBox.msgBox({
                "title": spjs.cBox.data.dlgHeader,
                "msg": spjs.cBox.i18n("unsubscribeText"),
                "ok": function () {
                    if (location.search.match(/\?Unsubscribe|\&Unsubscribe/) !== null) {
                        location.href = location.href.split(/\?Unsubscribe|\&Unsubscribe/)[0];
                    } else {
                        spjs.cBox.closeDlg();
                    }
                }
            });
        }
        

        2: The header and footer row are the ones shown in the attachment (1 is headerRowTemplateOverride and 2 is footerRowTemplateOverride) – do you want to add data from the form here?

        Adding the Title to the subject is done like this – use same format for other fields:

        "subject": "New comment by {author} on item with Title: " + getFieldValue("Title")
        

        3: You must show me with an image what you want to change. All style applied to the solution can be found in the css file spjs-cBox.css that you link to in the custom css tab – you can edit it to change the styles.

        Alexander

        in reply to: Autocomplete Issue #37153
        Alexander Bautz
        Keymaster

          You might have to remove the cascading dropdown and re-initiate it when the values are set. Read about it here and use the spjs.casc.kill(fin) and then spjs.casc.init({…}) to reapply it after the copy is done.

          Alexander

          Alexander Bautz
          Keymaster

            Thanks for the feedback – I’m glad it worked.

            Alexander

            Alexander Bautz
            Keymaster

              You can do that using a query like this. Please note that you must change the /site/doc_lib_name search text to match your doc library FileDirRef

              spjs.ac.textField({
                  "applyTo": "your_field_name",
                  "helpText": "Start typing",
                  "loadText": "Searching...",
                  "listGuid": "your_doc_lib_name_or_guid",
                  "listBaseUrl": _spPageContextInfo.webServerRelativeUrl,
                  "showField": "FileLeafRef",
                  "searchFields": ["FileLeafRef"],
                  "filterCAML": "",
                  "useREST": true,
                  "preloadData": true,
                  "filterREST": "FSObjType eq 1 and FileDirRef eq '/site/doc_lib_name'",
                  "optionDetailFields": [],
                  "optionDetailPrefix": [],
                  "enforceUniqueValues": false,
                  "rowLimit": 15,
                  "listOptionsOnFocus": true,
                  "minLengthBeforeSearch": 1,
                  "reValidateOnLoad": true,
                  "allowAddNew": true,
                  "isLookupInSelf": false,
                  "addNewAdditionalFields": [],
                  "multiselect": false,
                  "multiselectSeparator": "; ",
                  "orderBy": [],
                  "clearSetFieldsOnInvalidSelection": true,
                  "setFields": [],
                  "debug": false
              });
              

              Alexander

              in reply to: issue with 1.0.33.0 with old forms #37148
              Alexander Bautz
              Keymaster

                I have released a new version that should fix this issue (and one other) – see change log for details.

                Let me know how it works out.

                Alexander

                in reply to: issue with 1.0.33.0 with old forms #37145
                Alexander Bautz
                Keymaster

                  Hi,
                  Thanks for reporting this issue – I have confirmed it and will fix it as soon as possible.

                  Alexander

                  in reply to: Chevron Above Tabs Showing Status #37138
                  Alexander Bautz
                  Keymaster

                    It’s difficult to tell without looking at it. Can you email me some screenshots?

                    Alexander

                    in reply to: Edit form breaking when I use Lookup fields #37133
                    Alexander Bautz
                    Keymaster

                      Hi,
                      It looks like there is a bug related to using “Title (linked to item)” in the “In this column” – change it to “Title” – see attachment.

                      I’ll look into fixing this in the next version.

                      Alexander

                      in reply to: Autocomplete Issue #37123
                      Alexander Bautz
                      Keymaster

                        Here is an example. Add it to your NewForm and configure the spjs.ac.textField call to match your field and the arrOfFieldsToPrefill to include all the fields you want to prefill.

                        spjs.ac.textField({
                          "applyTo": "Name_of_autocomplete_field",
                          "helpText": "Start typing",
                          "loadText": "Searching...",
                          "listGuid": _spPageContextInfo.pageListId,
                          "listBaseUrl": _spPageContextInfo.webServerRelativeUrl,
                          "showField": "Title",
                          "searchFields": ["Title"],
                          "filterCAML": "",
                          "useREST": true,
                          "preloadData": false,
                          "filterREST": "",
                          "optionDetailFields": [],
                          "optionDetailPrefix": [],
                          "enforceUniqueValues": false,
                          "rowLimit": 15,
                          "listOptionsOnFocus": true,
                          "minLengthBeforeSearch": 1,
                          "reValidateOnLoad": true,
                          "allowAddNew": true,
                          "isLookupInSelf": false,
                          "addNewAdditionalFields": [],
                          "multiselect": false,
                          "multiselectSeparator": "; ",
                          "orderBy": [],
                          "clearSetFieldsOnInvalidSelection": true,
                          "setFields": [{
                            "fromFIN": "ID",
                            "joinBy": "",
                            "toFIN": "DUMMY_USING_CUSTOM_JS",
                            "parseFunction": "getSelectedItemAndPrefill",
                            "skipIfEmpty": false
                          }],
                          "debug": false
                        });
                        
                        function getSelectedItemAndPrefill(id) {
                          var arrOfFieldsToPrefill = [
                            "Field_1",
                            "Field_2",
                            "Field_3"
                          ];
                        
                          var select = [];
                          var expand = [];
                        
                          arrOfFieldsToPrefill.forEach(fin => {
                            var type = spjs.dffs.fieldtype[fin];
                            console.log(type);
                            switch (type) {
                              case "SPFieldUser":
                              case "SPFieldUserMulti":
                                select.push(fin + "/Name");
                                expand.push(fin);
                                break;
                              case "SPFieldLookup":
                              case "SPFieldLookupMulti":
                                select.push(fin + "Id");
                                break;
                            }
                          });
                        
                          jQuery.ajax({
                            "url": _spPageContextInfo.webServerRelativeUrl + "/_api/web/lists/getbyid('" + _spPageContextInfo.pageListId + "')/items(" + id + ")?$select=*," + select.join(",") + "&$expand=" + expand.join(","),
                            "method": "GET",
                            "headers": {
                              "Accept": "application/json;odata=verbose",
                              "content-type": "application/json;odata=verbose"
                            },
                            "success": function (data) {
                              arrOfFieldsToPrefill.forEach(fin => {
                                var item = data.d;
                                var type = spjs.dffs.fieldtype[fin];
                                var val;
                                switch (type) {
                                  case "SPFieldUser":
                                    val = item[fin];
                                    if (val.Name !== undefined) {
                                      setFieldValue(fin, val.Name);
                                    }
                                    break;
                                  case "SPFieldUserMulti":
                                    val = item[fin];
                                    if (val.results !== undefined) {
                                      val.results.forEach(user => {
                                        if (user.Name !== undefined) {
                                          setFieldValue(fin, user.Name);
                                        }
                                      });
                                    }
                                    break;
                                  case "SPFieldLookup":
                                    val = item[fin + "Id"];
                                    if (val !== null) {
                                      setFieldValue(fin, val);
                                    }
                                    break;
                                  case "SPFieldLookupMulti":
                                    val = item[fin + "Id"];
                                    setFieldValue(fin, val.results);
                                    break;
                                  case "SPFieldMultiChoice":
                                    val = item[fin];
                                    if (val !== null && val.results !== undefined) {
                                      setFieldValue(fin, val.results);
                                    }
                                    break;
                                  case "SPFieldTaxonomyFieldType":
                                    val = item[fin];
                                    if (val !== null) {
                                      setFieldValue(fin, val.Label);
                                    }
                                    break;
                                  case "SPFieldTaxonomyFieldTypeMulti":
                                    val = item[fin];
                                    if (val !== undefined && val.results !== undefined) {
                                      var arr = [];
                                      val.results.forEach(tax => {
                                        arr.push(tax.Label);
                                      });
                                      setFieldValue(fin, arr);
                                    }
                                    break;
                                  case "SPFieldURL":
                                    val = item[fin];
                                    if (val !== null) {
                                      setFieldValue(fin, val.Url + "," + val.Description);
                                    }
                                    break;
                                  case "SPFieldDateTime":
                                    val = item[fin];
                                    if (val !== null) {
                                      spjs.utility.setDateFieldFromDateObject(fin, new Date(val));
                                    }
                                    break;
                                  default:
                                    val = item[fin];
                                    if (val !== null) {
                                      setFieldValue(fin, val);
                                    }
                                    break;
                                }
                              });
                            },
                            "error": function (data) {
                              console.log(data);
                            }
                          });
                        }
                        

                        Alexander

                        in reply to: Autocomplete Issue #37119
                        Alexander Bautz
                        Keymaster

                          The reason you only see one is that “Cast name” is not unique. The way this works, the “ShowField” value must be unique. To achieve this you can concatenate for example CAST_x0020_Name and Title in a calculated column and use that new field as “ShowField”.

                          What kind of fields are there in this list? – the code would have to query the other list item and will retrieve the data stored in sharepoint and not the “display value” used in the form. This means people pickers, multichoice fields, lookup fields and date fields must be manipulated before it can be filled into the form.

                          I have some functions to copy an item already in the forum, but can write up a new example if I know what kind of fields you are using.

                          Alexander

                          in reply to: Autocomplete Issue #37115
                          Alexander Bautz
                          Keymaster

                            1: I’s hard to tell without looking at the code for your autocomplete and a screenshot of the dropdown / search.

                            2: Copying 120+ fields using setFields in an autocomplete most likely won’t work, but you can try. It would most likely be best to write a custom function to do the copying / creation of the new item. I’m curious as to why you would want to copy 120+ fields – what are you trying to achieve?

                            Alexander

                            Alexander Bautz
                            Keymaster

                              I looked at the code and can confirm this bug. The problem was that I only validated the access rights when the user clicked / selected an item in the list view and not initially when the page loaded.

                              I’ll get this fixed in the next release – hopefully over next weekend.

                              Alexander

                              in reply to: CommentBox Basics #37108
                              Alexander Bautz
                              Keymaster

                                Hi,
                                Yes, it requires a separate license: https://spjsblog.com/commentbox-for-sharepoint/#Buy_a_license

                                There is a built in trial period, and you can get an extended trial if you need that.

                                You do not need to add any columns to the parent list item, but you must add the placeholder for the comments (in line 2 of spjs-cBox_CEWP.html) to a HTML section in your form.

                                It has been some time since I tried cBox in DFFS, but if you have added all the scripts (DO NOT ADD JQUERY – it is already loaded) in the top of the spjs-cBox_CEWP.html file in the textarea at the top of your custom js tab and ensured that all paths to the files are correct and you still get this error, you can try wrapping the function call and the license code setting in line 16 inside a function named dffs_ready – like this:

                                function dffs_ready(){
                                  /* Add license code here */
                                  spjs.cBox.licenseCode = "";
                                  /* Configuration object */
                                  var cBoxArg = {
                                    ....
                                    // the rest of the argument object here
                                    ....
                                  }
                                }
                                

                                Please remember to add the cBox css file link to the top of the custom css tab.

                                Alexander

                                in reply to: Changing buttons at the bottom of form #37101
                                Alexander Bautz
                                Keymaster

                                  You can insert buttons at the bottom the same way as you do with the top ones. Find the id or class of the item you want to prepend or append to, and just insert them.

                                  To change the behavior of a button, you must address the button using the class of Id and apply your new onClick. Use default jQuery selectors if you want to use jQuery: https://api.jquery.com/category/selectors/

                                  Alexander

                                Viewing 15 posts - 256 through 270 (of 4,705 total)