Il faut le faire avec du javascript.
Regarde au niveau du "Masked Input"
http://webdeveloperplus.com/jquery/how-to-mask-input-with-jquery/