解:
解决了!我没有通过作曲家安装插件,而是手动复制并粘贴了jquery-mask js文件内容并将其导入。:)
题:
我需要在Symfony 3.1.1表单的文本字段中添加掩码。这是我呈现的形式:
{# E-mail // Usuario #}
<div class="row">
<div class="col-md-5 col-md-offset-1">
E-mail<span style="color: #217db1;">*</span></br>
{{ form_widget(form.email, { 'attr': {'class': 'formularioRegistro'} }) }}
{{ form_errors(form.email) }}
</div>
</div>
<div class="row">
{# CPF #}
<div class="col-md-5 col-md-offset-1">
CPF (somente números)<span style="color: #217db1;">*</span></br>
{{ form_widget(form.cpf, { 'attr': {'class': 'formularioRegistro'} }) }}
{{ form_errors(form.cpf) }}
</div>
</div>
我要为CPF字段添加掩码,该掩码应具有以下格式:“ _ _ _。_ _ _。_ _ _ _ _ _”。我的意思是,“ 3位数字指向3位数字指向3位反斜杠2位”。
我试图使用javascript引用输入ID,但没有成功。
使用这个jQuery插件。
https://igorescobar.github.io/jQuery-Mask-Plugin/
在表格中:
$builder->add(
'property', TextType::class, array(
'required' => false,
'attr' => ['data-mask' => '000.000.000-00']
'placeholder' => '_ _ _ . _ _ _ . _ _ _ - _ _'
));
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句