-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
List fields editable required value #5691
Comments
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Yes. This issue is still relevant. I still haven’t received any feedback. |
I think using |
@greg0ire using |
🤔 We should probably update the docs, using the name is deprecated.
But it does affect my understanding… I thought you were using a Sonata type, but this is a native form type. Is the bug that the native HTML5 required attribute is not rendered? And why do you say
You are using that option in your example |
I have taken a look at this and I think we are mixing things. This example is talking about the list, as @peter-gribanov said, the types available are in the docs. This has nothing to do with Symfony Type forms, but because this issue is about
I think this won't work because as I said this is about the list and That being said, the permission you already have in you entity is also one of the |
All is well. I understood. The problem is on my side. Sorry. The problem is that i use ValueObject and when casting object to a string, the label is returned, not the value. Solution for me: {# @Frontend/Testimonial/admin/list_permission.html.twig #}
{% extends admin.getTemplate('base_list_field') %}
{% set is_editable =
field_description.options.editable is defined and
field_description.options.editable and
admin.hasAccess('edit', object)
%}
{% set x_editable_type = field_description.type | sonata_xeditable_type %}
{% block field_span_attributes %}
{%- if is_editable and x_editable_type %}
class="x-editable"
data-type="{{ xEditableType }}"
data-title="{{ field_description.label|trans({}, field_description.translationDomain) }}"
data-pk="{{ admin.id(object) }}"
data-url="{{ url }}"
data-source="{{ field_description | sonata_xeditable_choices | json_encode }}"
{# correct resolve value for x-editable #}
data-value="{% if value.isAwaiting %}approved{% else %}{{ value.value }}{% endif %}"
{%- endif -%}
{% endblock %}
{% block field -%}
{%- set bem_modifier %}
{%- if value.isAwaiting -%}
label-danger
{%- elseif value.isApproved -%}
label-success
{%- else -%}
label-warning
{%- endif -%}
{%- endset -%}
<span class="label {{ bem_modifier }}">{{ value | trans({}, field_description.options.catalogue) }}</span>
{%- endblock %} Sorry again. |
Environment
Sonata packages
Symfony packages
PHP version
Subject
Need add a required option to oblige to select a value from the list of valid values.
Perhaps a related issue #5693.Steps to reproduce
Make entity
Configure field as editable in admin service
Go to admin. Change the permission, but do not select a value
Expected results
It is necessary to separate the case when we can use
NULL
as a value, and when not. In my case,NULL
is not a valid value.Actual results
Click submit and get 500 error because
NULL
comesThe text was updated successfully, but these errors were encountered: