If you want that done without submitting the form, use javascript. Perhaps give the form an id to hook into. Contao comes with Mootools, that shuld make it easier to do it, though I never use it myself...
If you want to validate the input upon submitting and reporting back if the input is invalid, you can use the processFormData hook, described at http://www.contao.org/hooks.html
processFormData
The processFormData hook is triggered after a form has been submitted. It passes the form data array, the Data Container Array and the files array as arguments and does not expect a return value. It is available from version 2.4.4.
Code:
// config.php
$GLOBALS['TL_HOOKS']['processFormData'][] = array('MyClass', 'myProcessFormData');
// MyClass.php
public function myProcessFormData($arrPost, $arrForm, $arrFiles)
{
// Do something
}
Bookmarks