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

fix: Do not render hidden form fields twice #1848

Merged
merged 4 commits into from
Jul 5, 2022

Conversation

Dosenpfand
Copy link
Contributor

Description

With all existing form widgets hidden fields are rendered twice, once via {{form.hidden_tag()}} and once via {{ lib.render_field(...) }}
This PR excludes the rendering from lib.render_field().
Additionally, it gets rid of a closing </td> for every hidden field for which there was no opening tag.
There is still a empty <tr></tr> remaining, because the code structure.

Example

Before

<form id="model_form" action="" method="post" enctype="multipart/form-data">
<input id="id" name="id" type="hidden" value="6">
<input id="csrf_token" name="csrf_token" type="hidden" value="IjQ5NWM1YmE5MDRmOGYzZGY1OGQwMjIwNGNkMTU4MzZjNDgwYmZiMDUi.Ynq7_A.uwEWVJea7w42o2ZMe83znKaQR4o">
        <div class="table-responsive">
            <table class="table table-bordered">
                        <tr>
            <input id="id" name="id" type="hidden" value="6">
            </td>
                        </tr>
                        <tr>

After

<form id="model_form" action="" method="post" enctype="multipart/form-data">
<input id="id" name="id" type="hidden" value="6">
<input id="csrf_token" name="csrf_token" type="hidden" value="ImQ3MTc5ZDE4ZDYzYTVkZGNkMDZjYjIwNjFiZjQyY2ViNzZhYzcyYzki.YnrQBA.lh6UCFkoGUugpTCwdUbBNq6zlRM">
        <div class="table-responsive">
            <table class="table table-bordered"> 
                        <tr>
                        </tr>

ADDITIONAL INFORMATION

  • Has associated issue:
  • Is CRUD MVC related.
  • Is Auth, RBAC security related.
  • Changes the security db schema.
  • Introduces new feature
  • Removes existing feature

@dpgaspar
Copy link
Owner

dpgaspar commented Jul 5, 2022

Thank you, once more @Dosenpfand!

@dpgaspar dpgaspar merged commit ccc6292 into dpgaspar:master Jul 5, 2022
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

Successfully merging this pull request may close these issues.

2 participants