(Resolved) Trouble with ‘allowAddNew’ set to True

Forums Autocomplete (Resolved) Trouble with ‘allowAddNew’ set to True

Viewing 2 reply threads
  • Author
    Posts
    • #28141
      Andrew Beno
      Participant

      Hey good afternoon,
      I’m running into an issue with the autocomplete that I’m hoping to get some help with. It’s configured in such a way that I’m using the autocomplete on the same list where I’m adding/editing items (which appears to be supported), and so far everything works ok except if I try to enter a value that’s not already in the list items that have been returned for autocomplete. Below is the gist of what I’m experiencing (same behavior on new and edit screens):
      – Create new item and select the ‘Title’ field
      – Dropdown appears and shows unique, existing entries to choose from if applicable.
      – In my case, I want to add a new value that’s not in the list already (ie. “test”).
      – The message shown below the field is “No items match your search – Add test to the list?”
      – I click the red text to add the item to the list, but I cannot save the form. It says “You must specify a value for this required field” even though there is a value in the field..
      – The only way to get the item to save is by selecting a choice from the list, overwriting the text to be “test” .. choosing the option to add ‘test’ to the list again, and then clicking Save. After saving however, the value isn’t “test” but rather what I chose from the list!
      – I tried changing the configuration to not show as a list (so, setting ‘listOptionsOnFocus’ to false) – however in the end the behavior is more or less the same w/the exception that I don’t see the dropdown choices when selecting the field.

      Here is the JS that’s being used:

      spjs.ac.textField({
       "applyTo": "Title",
       "helpText": "Enter an application name",
       "loadText": "Please wait while application names are loaded...",
       "listGuid": "{f0aa469f-e1c4-464d-a992-7f101e199612}",
       "listBaseUrl": "/sites/eps-sandbox",
       "showField": "Title",
       "searchFields": [],
       "filterCAML": "",
       "useREST": true,
       "preloadData":true,
       "filterREST": "",
       "optionDetailFields": [],
       "optionDetailPrefix": [],
       "enforceUniqueValues": true,
       "rowLimit": 15,
       "listOptionsOnFocus": true,
       "minLengthBeforeSearch": 3,
       "reValidateOnLoad": false,
       "allowAddNew": true,
       "isLookupInSelf": true,
       "addNewAdditionalFields": [],
       "multiselect": false,
       "multiselectSeparator": "; ",
       "orderBy": [{
          "fin": "Title",
          "ascending": true,
          "numeric": false,
          "parseFunction": ""
      }],
       "clearSetFieldsOnInvalidSelection": false,
       "setFields": [],
       "debug": false
      });

      Hopefully someone can help! This seems like very useful functionality. In the meantime I’ll try and upgrade to the latest version to see if it helps, even though the release notes don’t mention this issue.

      Thanks,

      Andy

      • This topic was modified 4 years, 2 months ago by Andrew Beno.
      • This topic was modified 4 years, 2 months ago by Andrew Beno.
    • #28145
      Andrew Beno
      Participant

      Actually, I just resolved this – the fix was to change “useREST” and “preloadData” from true to false and that seemed to fix the issue.

    • #28147
      Alexander Bautz
      Keymaster

      I’m glad you got it sorted. Please note that I have not thought of this scenario where you add an item to the same list as you actually target with the autocomplete so please test it thoroughly to ensure it works as expected.

      Alexander

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