Добавление шаблона ввода (pattern) в поле

Добавляется в parametrs.php шаблона поля:

<tr>
    <td class="key"><label for="alphaindex">Шаблон</label>&nbsp;&nbsp;</td>
    <td><input class="text_area" type="text" name="parametrs[pattern]" id="pattern" size="42" maxlength="250" value="<?=str_replace('"',"&#34;",$parametrs['pattern']);?>" on-keyup="document.getElementById('pattern-test').setAttribute('pattern',this.value);" /></td>
    <td><a target="_blank" href="http://htmlbook.ru/html/input/pattern">описание и примеры</a></td>
</tr>
<tr>
    <td class="key"><label for="alphaindex">Тест шаблона</label>&nbsp;&nbsp;</td>
    <td><input class="text_area" type="text" id="pattern-test" size="42" maxlength="250" pattern="<?=str_replace('"',"&#34;",$parametrs['pattern']);?>" value="" /></td>
    <td></td>
</tr>
<style type="text/css">
    #pattern-test:valid {
        background-color: #cfc;
    }
    #pattern-test:invalid {
        background-color: #fcc;
    }
</style>