Dynamic textfiled character restriction

how can i restrict max number of characters in a dynamic textfield?
is it possible somehow?