Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with form field type tel #192

Open
Chazz09 opened this issue Sep 15, 2017 · 2 comments
Open

Error with form field type tel #192

Chazz09 opened this issue Sep 15, 2017 · 2 comments

Comments

@Chazz09
Copy link

Chazz09 commented Sep 15, 2017

Form field type: tel does not work.

This:

phone:
            type: tel

Results in an exception:
"An exception has been thrown during the rendering of a template ("Could not load type "tel"")"

Just to be sure I'm trying to achieve:
<input type="tel">

How can I get this to work?

@rossriley
Copy link
Collaborator

Unfortunately at the moment Symfony Forms doesn't support a telephone number type, the closest you can get is:

phone:
    type: number

I have a feeling it's not customisable via the config but the way to customise attributes is via the attr config like this:

phone:
    type: number
    attr:
        type: tel

If that doesn't work then you would need to tweak the form template to show a different widget based on a class or data attribute.

@Chazz09
Copy link
Author

Chazz09 commented Sep 18, 2017

Ok changing it in the config unfortunately doesn't work by adding attr: type: tel.

In the form template I also tried adding it as a attribute, like this:
<span class="boltforms-value">{{ form_widget(form[key], { 'attr': {'type': 'tel'} } ) }}</span>

But this doesn't change anything also. Any suggestions on how to add this in to the form template?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants