# In DynamicModule, InputField does not display the update when its variable updates through PopupWindow. How to fix this?

Here's a minimal example:

DynamicModule[{var = "", searchlist, randobutton},
searchlist =
Table[StringJoin[RandomSample[CharacterRange["a", "z"], 7]], 40];
randobutton =
Button["randotxt",
var = StringJoin[RandomSample[CharacterRange["a", "z"], 2]]];
Deploy@Panel[#, ImageSize -> {Automatic, 300}] &@
Column[{Dynamic[var, TrackedSymbols :> {var}],
PopupWindow[Button["pop", Nothing], randobutton],
randobutton,
InputField[Dynamic[var, TrackedSymbols :> {var}], String,
ContinuousAction -> True],
Dynamic@Column[If[var === "",
{"[empty]"},
Select[searchlist, StringContainsQ[var]]]]
}, Center]
]


If you press the main button, the InputField's string updates. If you press the popup's button, this does not occur. If the Dynamic[var] outside of the InputField did not have the TrackedSymbols option specified, it would exhibit the same behavior as the InputField, but the same fix does not work for the InputField.

How do I fix this bug?

Thank you very much for the help.

(edit: removed extra comma)

• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. Aug 24 '21 at 21:19
• Please take a look at InheritScope.
– Kuba
Aug 25 '21 at 5:16
• So, I replaced PopupWindow for CreateDialog[ __ ] which works on the front end. Thanks! @Kuba I'm curious why the TrackedSymbols change worked for the Dynamic[] but not the InputField[].
– jWey
Aug 25 '21 at 7:53

## 1 Answer

PopupWindow is the wrong function. You can use CreateDialog instead.

Here's an updated version:

DynamicModule[{...},
...
...Column[{
Dynamic[var],
Button["pop",
CreateDialog[
DynamicModule[{}, randobutton, InheritScope -> True]]],
randobutton,
InputField[Dynamic[var], ...],
...
}]
]