Home › Forums › Autocomplete › (Resolved) Trouble with ‘allowAddNew’ set to True
- This topic has 2 replies, 2 voices, and was last updated 4 years, 12 months ago by Alexander Bautz.
-
AuthorPosts
-
-
January 3, 2020 at 19:21 #28141
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, 12 months ago by Andrew Beno.
- This topic was modified 4 years, 12 months ago by Andrew Beno.
-
January 3, 2020 at 19:26 #28145
Actually, I just resolved this – the fix was to change “useREST” and “preloadData” from true to false and that seemed to fix the issue.
-
January 3, 2020 at 20:48 #28147
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
-
-
AuthorPosts
- You must be logged in to reply to this topic.