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

Whitespace in choice_widget_option #453

Open
AntoineLemaire opened this issue Oct 24, 2016 · 2 comments
Open

Whitespace in choice_widget_option #453

AntoineLemaire opened this issue Oct 24, 2016 · 2 comments

Comments

@AntoineLemaire
Copy link

My form :

$builder->add('grade', \Symfony\Component\Form\Extension\Core\Type\ChoiceType::class, [
    'choices'  => ['1' => 1, '2' => 2, '3' => 3, '4' => 5, '5' => 6],
    'required' => false,
    'label'    => 'app.label',
]);

My twig :

{{ form_start(formTest) }}
    {{ form_widget(formTest.grade) }}
{{ form_end(formTest) }}

Result :

capture du 2016-10-24 18-37-43

Instead of

capture du 2016-10-24 18-39-20

But I don't understand because it's work with that: Yoopies@987e91d, even if choice_widget_options block is under {% spaceless %}

@nifr
Copy link
Contributor

nifr commented Oct 26, 2016

{% spaceless %} does not do anything inside html tags. Have a look at the documentation.

Use the spaceless tag to remove whitespace between HTML tags, not whitespace within HTML tags or whitespace in plain text:

You can easily control/adjust whitespace to your liking using css ( white-space ). There's a nice interactive widget to play around with over at MDN Link

{{- and -}} can be used additionally to strip any whitespace inside tags.

@AntoineLemaire
Copy link
Author

AntoineLemaire commented Oct 26, 2016

Right, I had not enouth read the doc about {%spaceless% }
But this change has been introduce with 1490682

Sould we bring back the whitespace logic as before instead of add useless spaces which could break our javascript?
In case of JS problem, CSS is unfortunately not an option

https://jsfiddle.net/saw9fhfo/

@AntoineLemaire AntoineLemaire changed the title spaceless not working choice_widget_option Whitespace in choice_widget_option Oct 26, 2016
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