1

I'm trying to change the "text" type of a input using Twig and Silex but looks that I'm doing something wrong.

This is the basic code I'm doing:

<div class='form-group'>
    {{ form_label("Id") }}
    {{ form_widget("id", { attr: { 'class': 'form-control' }}) }}
</div>

I want that this id field be an integer.

1 Answer 1

2

in Symfony you need to change the type in your formtype:

->add('streetNo', NumberType::class, ['required' => true])

For older versions of Symfony it looks like this:

->add('streetNo','number', ['required' => true])

The twig "doesn't care" about the input type. I would think that it is the same for Silex as it is build on Symfony.

1
  • Yeah, that's the way. Thanks.
    – Louis B
    Commented Jan 25, 2016 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.