Autocomplete setFields clears Fileds

Home Forums Autocomplete Autocomplete setFields clears Fileds

Viewing 7 reply threads
  • Author
    Posts
    • #22688
      Michael
      Participant

        Hi,
        i have a problem regarding the setFields Function in the autocomplete plugin.
        As soon as the configured field was focused (for example someone clicked on the field and then clicked on another field) the “conected” fields are overwritten / cleared.

        If the ac field was justed focused, but nothing enterd, the connected fields are set to nothing / cleared.
        Is there a way that the setField Option only fires AFTER a valid autocomplete selection?

        Best Regards,
        Michael

      • #22696
        Alexander Bautz
        Keymaster

          I’m not able to recreate this behavior – which version of the spjs-ac plugin are you using?

          If you are using the latest version, please post the config for the spjs.ac here so I can look at it.

          Alexander

        • #22724
          Michael
          Participant

            Hi Alexander,
            here is the information:
            SPJS-Autocomplete plugin v1.6.26

            
            
            spjs.ac.textField({
             "applyTo":"FileLeafRef",
             "helpText":"Bitte geben Sie eine Nummer ein",
             "listGuid":"{b6b26d93-ea2d-4afb-94de-edc84ffc4e36}",
             "listBaseUrl":"/path/site",
             "showField":"Nummer",
             "optionDetailFields":["Nummer1","Nummer2"],
             "enforceUniqueValues":true,
             "rowLimit":15,
             "listOptionsOnFocus":false,
             "minLengthBeforeSearch":3,
             "reValidateOnLoad":false,
             "allowAddNew":false,
             "isLookupInSelf":false,
             "addNewAdditionalFields":[],
             "filterCAML":"",
             "multiselect":false, 
             "multiselectSeparator":"; ",
             "orderBy":[],
             "setFields":[{
             "fromFIN":["Nummer2"],
             "joinBy":"",
             "toFIN":"Kunde",
             "parseFunction":"",
             "skipIfEmpty":false
            }
            
            ] 
            });

            Best Regards,
            Michael

          • #22736
            Alexander Bautz
            Keymaster

              Ah, I see now what you mean. If the autocomplete field is not filled in with a valid choice and you focus on it and then removes focus without setting a valid option, any existing values in the setFields will be cleared.

              Can you explain how you use this, because I would think the setFields should be set by the autocomplete and not have a value if the primary autocomplete field is not set.

              Alexander

            • #22757
              Michael
              Participant

                Hello Alexander,

                the field were autocomeplete is appended is “CustomerNumber” Field and the the field that is set is “CustomerName”.
                When a new item in the list is created, it is possible that we do not have a “CustomerNumber” in this phase of the project, so this field is not used, but because we need a customername to identify the item the “CustomerName” Field is visible an can be edited / filed manually.
                As soon as we have a customernumber, the item should be edited and the correct customer name should be pulled from our customerlist (selected by customernumber) and the manually entered value should be replaced.

                Now if somebody “checks” if the entry is availabel in the customerlist, the customername field is cleared if no value is found.

                Regards,
                Michael

              • #22766
                Alexander Bautz
                Keymaster

                  OK, I’ll add a new option in the configuration in the next version (during the weekend) and so you can prevent the fields from being cleared on invalid selections.

                  Alexander

                • #22780
                  Michael
                  Participant

                    Hi Alexander,

                    as always: Thanks for your help!

                    Best Regards,
                    Michael

                  • #22816
                    Alexander Bautz
                    Keymaster

                      I have updated the DFFS package – including the fix for spjs-ac: https://spjsblog.com/2018/11/10/dffs-package-updated-to-v4-4-3-58/

                      See the instructions for the ac plugin here: https://spjsblog.com/dffs/dffs-plugins/spjs-autocomplete/#clearSetFieldsOnInvalidSelection

                      Alexander

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