There are lot of ways to do that. You can insert values when the particular events happens on the control probably on the events of the control which you want.

for example, onfoucus, onunfocus something like this..