is an option for InputField that specifies a function to apply to the input field's contents to generate a list of completions.
FieldCompletionFunction
is an option for InputField that specifies a function to apply to the input field's contents to generate a list of completions.
Details
- The default value of FieldCompletionFunction->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 InputField. If the result of calling the function is a 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 ContinuousAction->False has been set.
Examples
open all close allBasic Examples (2)
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[#] <> "*"]&)]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"}&)]See Also
Related Guides
History
Text
Wolfram Research (2017), FieldCompletionFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/FieldCompletionFunction.html.
CMS
Wolfram Language. 2017. "FieldCompletionFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FieldCompletionFunction.html.
APA
Wolfram Language. (2017). FieldCompletionFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FieldCompletionFunction.html
BibTeX
@misc{reference.wolfram_2026_fieldcompletionfunction, author="Wolfram Research", title="{FieldCompletionFunction}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/FieldCompletionFunction.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_fieldcompletionfunction, organization={Wolfram Research}, title={FieldCompletionFunction}, year={2017}, url={https://reference.wolfram.com/language/ref/FieldCompletionFunction.html}, note=[Accessed: 12-June-2026]}