You have a much bigger journey than you realise. You will need to learn and program Acrobat JavaScript - and not just drop code into fields.
You should realise that want you want to do is not the normal or typical way to use a PDF form. It seems possible, but you will have to develop the solution.
(You could steal it from the sample file you have, but I can't advise using copyright code without permission no matter how easy it is to copy/paste; it's just as easy to demonstrate that you copied it.)
I recommend you consider one of the better trodden paths for doing this task.