({{, (RefLink[FieldCompletionFunction, paclet:ref/FieldCompletionFunction]) 
is an option for (RefLink[InputField, paclet:ref/InputField]) that specifies a function to apply to the input field's contents to generate a list of completions.}})

OpenersNotesSection(Spacer1)Details

The default value of (RefLink[FieldCompletionFunction, paclet:ref/FieldCompletionFunction])->(RefLink[Automatic, paclet:ref/Automatic]) indicates that there will be no completion menu for the input field.

When a field completion function is specified, the front end will call the function with the current contents of the (RefLink[InputField, paclet:ref/InputField]). If the result of calling the function is a (RefLink[List, paclet:ref/List]), then the front end will display the elements of the list in a completion popup menu, which is typically positioned immediately below the input field.

If the completion function returns an empty list, no menu will be displayed.

The completion function will be called after every keystroke, even if (RefLink[ContinuousAction, paclet:ref/ContinuousAction])->(RefLink[False, paclet:ref/False]) has been set.

OpenersPrimaryExamplesSection(Spacer1)Examples  (5)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Create an input field that offers a fixed set of completions:

InputField[1,FieldCompletionFunction->({"fish","fowl"}&)]

Use a completion function that modifies the existing input:

InputField["a",String,FieldCompletionFunction->({#<>"?"}&)]

OpenersExampleSection2(Spacer1)Applications  (2)

Create an input field that offers filename completions:

InputField["",String,FieldCompletionFunction->(FileNames[FileNameTake[#]<>"*",{DirectoryName[#]}]&)]

Create an input field that offers completions of all matching System` functions:

InputField[N,FieldCompletionFunction->(Names["System`"<>ToString[#]<>"*"]&)]

OpenersExampleSection3(Spacer1)Possible Issues  (1)

A completion function that returns one item will not work if it is not wrapped in a list:

InputField[1,FieldCompletionFunction->("the completion"&)]

The solution is to simply wrap it in a list:

InputField[1,FieldCompletionFunction->({"the completion"}&)]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ContinuousAction, paclet:ref/ContinuousAction])  ▪  (RefLink[PopupMenu, paclet:ref/PopupMenu])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Controls Options, paclet:guide/ControlsOptions])}})}})