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

Trix text editor #2811

Closed
gabrielmustiere opened this issue Jul 2, 2019 · 4 comments · Fixed by #2813
Closed

Trix text editor #2811

gabrielmustiere opened this issue Jul 2, 2019 · 4 comments · Fixed by #2813
Labels
Milestone

Comments

@gabrielmustiere
Copy link

Symfony 4.3.1 and Easyadmin 2.2.1

When adding or modifying an entity containing a field based on the new Trix widget (text_editor), an error is thrown, the null value is assigned to the field in question.

In the profiler, the field is outside the edited entity in the POST parameters. The field has its own entry.

@yceruto yceruto added the bug label Jul 2, 2019
@yceruto yceruto added this to the 2.x milestone Jul 2, 2019
@yceruto
Copy link
Collaborator

yceruto commented Jul 2, 2019

Could you show us exactly what is the error message?

@javiereguiluz
Copy link
Collaborator

javiereguiluz commented Jul 2, 2019

That's strange ... because the Trix editor continuously updates the value of a hidden input which is what's submitted in the form. See

{% block easyadmin_text_editor_widget %}
<input id="{{ id }}" value="{{ data }}" type="hidden" name="{{ name }}">
<div class="easyadmin-text-editor-wrapper">
<trix-editor input="{{ id }}" data-js-url="{{ asset("bundles/easyadmin/form-type-text-editor.js") }}" data-css-url="{{ asset("bundles/easyadmin/form-type-text-editor.css") }}"></trix-editor>
</div>
{% endblock easyadmin_text_editor_widget %}

@gabrielmustiere
Copy link
Author

This is the 500 error
image

And the POST request in the profiler
image

@yceruto
Copy link
Collaborator

yceruto commented Jul 2, 2019

Fixed in #2813

javiereguiluz added a commit that referenced this issue Jul 3, 2019
This PR was merged into the 2.0.x-dev branch.

Discussion
----------

Fix text_editor and code_editor HTML input name

Fixes #2811

For single forms without parent, the variable `name` is equal to `full_name` (e.g. `description`), but for compound forms `full_name` will contain also the name of the parent form (e.g. `product[description]`).

Commits
-------

5e8902e Fix text_edit and code_edit HTML input name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants