0

Right - I have a form, and I've been asked if I can do a global autocomplete on the 'suppliers' field.

My initial idea is to have a separate list of 'recent suppliers'. Then have the form field do a lookup on that list, and show them in a drop down suggestion list AS the submitter types the name of the supplier (not just a normal drop down menu). I'd also like it to, if the supplier name in the field doesn't match an existing one, add the form data as a new entry in that list.

Is this plausible?

0

there are a quite a few things to discuss. First of all you need a 'Suppliers' list; not a 'Recent Suppliers' list.

You are right, you need a data connection to that list which will populate your dropdown options. This list will be filtered by the values entered into a text box. If you have a very large list of suppliers it might be a good idea to somewhat filter that first, though. Set a format rule on your Suppliers dropdown to filter out (hide) items which don't contain the string entered into the textbox. You could for example ask your user to enter a couple of letters and then hit tab - the dropdown would now only show items which contain the combination of letters inputted.

Adding a new supplier to the original suppliers list can be done via workflow. Let's say the user enters a string that returns no suppliers, you'll add a rule to your form allowing the user to offer that string as a new supplier. On confirm you submit your form with two additional fields - one contains the name of the new supplier (you can add more fields of course if you need more metadata) and another hidden one (i.e. WF_Action) which can be either a Boolean or a string if you needed to trigger more than on workflow action. Add a workflow to the library (list) that triggers on your WF_Action field and creates a new item in the Suppliers list. Set that workflow to run on change. Might be a good idea to also let that workflow clear the WF_Action field when done.

Does that help a little?

  • that's brilliant, thanks very much - big help in pointing me in the right direction. I forgot to add in my original spec: the suppliers are only meant to be suggested if they've been used in the last 30 days, otherwise they drop off the list. So I was going to workflow the new list items to bin after 30 days. Hence the name 'recent suppliers'. Thanks very much for your help regardless, that's a real pointer. – Henry Cole Nov 27 '13 at 13:29
  • Getting there.. however as your suggestion of tabbing implied, the filter doesn't update until I focus elsewhere on the form (click/tab). Any ideas if it's possible to do this 'live' literally as they type? – Henry Cole Nov 27 '13 at 14:12
0

You can achieve an auto complete if you publish your form via SharePoint on a web page and add a content editor pointing to a little jQuery script as described here:

http://sympmarc.com/2011/08/24/using-spservices-with-jqueryuis-autocomplete-function-on-infopath-forms-in-sharepoint/

In that case you don't even have to load in the data via your form first.

In regards to the Suppliers list, I'd really recommend doing that in a different way. Let's say your users add forms which include a lookup field on a supplier - just add another lookup directly in your supplier list back to the lookup field in your form library. What you'll get is a counter and that is really useful. You can now for instance use that column to order your query results by the counter column basically resulting in the suppliers used the most turning up at the top of your dropdown.

If you aren't looking at hundreds or thousands of suppliers you could maybe provide a better user experience if you offered your users buttons to select suppliers instead of asking them to input anything.

You could for example create buttons for each letter of the alphabet and then simply filter a repeating table showing the results of your query by the letter pressed. Each button gets a rule that sends its letter to a hidden text field. When the button is pressed you run a rule that filters the suppliers list by 'Does not begin with' on the text field. If you also add a rule that hides the section in which you show your repeating table if there is no value in your text field, then you won't unnecessarily present your users with a huge list to start with.

Start with the A button and then simply copy it to create the others.

Ok, but how do you then let them pick a supplier? That's the nice and easy part. In your repeating list with the query results of your suppliers list, remove the title box by deleting it. Add a button into the same table field. Right click the button and in the properties change its name to the Title field (click FX). Finally set a rule on the button to set your actual value field - the one you want to submit - to the ID of the returned row. If your supplier column is a lookup to your Supplier list, it'll work fine like that.

Sorry for the long post. Hope it helps a little.

Let me know if you'd like a quick video to explain that a bit more. I can always put one together quickly.

Danny

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.