Create a routine that allows you to type information into a dialog box

I would like to be able to create a routine that allows me to receive a text typed in a dialog box, when I execute this routine (for example, through a button on my HA), it opens a dialog box asking me to type a text and confirm!
If I cancel the routine it is simply cancelled, if I confirm, the routine uses the entered value to continue execution!