0

Since the last update from php 7.3 to php 7.4, forced by my hosting provider, html issues are occurring in my forms. I am using Symfony 4 in combination with jQuery and Twig to render my html files and have them interact correctly. The issue that I described earlier is shown in the picture below.

The html element and the id of that particular element are concatenated within a html form, rendered by twig

Basically what happens is, whenever a template (html file) is rendered, the element 'name' and the 'id' don't have a space in between.

E.g. <divid=""> instead of <div id=""> and <textareaid=""> instead of <textarea id="">

The following file has this issue:

    <div class="page-container">
        <div class="main-content">
            <div class="section__content section__content--p30">

                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ path('admin_page') }}">Admin</a></li>
                    <li class="breadcrumb-item"><a href="{{ path('index_factuur') }}">Invoices</a></li>
                    <li class="breadcrumb-item active">Make invoice</li>
                </ol>

                <div class="container-fluid">

                    <div class="wrapper">
                        <div class="container-fluid">

                            <div id="live_form">
                                {{ form_start(form) }}
                                {{ form_errors(form) }}
                                {{ form_end(form) }}
                                <br>
                                {% include('includes/SOMEFILE') %}
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div> 

Does anyone have any clue what the issue can be and how the rendered file contains form elements that are pasting id to the html element itself?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Jeroen
  • 1
  • 2
  • No, it seems like that person (in the link) has issues with writing the variable itself. I'm having issues with the:
    , not what's inside the:
    here
    . It could make sense that twig still has issues with PHP 7.4 but I wonder what could be a fix then..
    – Jeroen Jan 05 '22 at 19:12
  • I can't spot the faulty `div` in the screenshot, but it doesn't match your twig: the form in the screenshot is rendered _outside_ the `#live_form`, so you must have some error with mismatched opening and closing tags in a template. Are you using a custom `form_theme`? – msg Jan 05 '22 at 20:02
  • Does this answer your question? https://stackoverflow.com/questions/64527136/symfony-form-element-id – Marleen Jan 05 '22 at 20:49
  • It does @Marleen! Upgrading the version of twig worked. Since older versions of Twig seemed to have some issues with PHP 7.4, I needed to upgrade it. – Jeroen Jan 07 '22 at 16:54
  • Please accept the duplicate next time. Do not edit the question to say it is solved. – Dharman Jan 07 '22 at 17:03

0 Answers0