1

Me gustaría saber si sabeis alguna forma de poner un valor nulo por defecto en el select easyadmin_autocomplete.

Aparece seleccionado el primer elemento del listado pero quiero que primero apunte a uno vacío (Elija uno). ¿Sabeis cómo hacerlo? ¿Se os ocurre alguna forma combinando las opciones definidas?

#easy_admin.yml
Product:
      class: App\Entity\Product
      controller: App\Controller\ProductController
      new:
        fields:
          - { property: 'category', label: 'Category', type: 'easyadmin_autocomplete', type_options: { class: 'App\Entity\Category' } }
 }

Estas son las opciones definidas para el attr fields -> type_options del yml:

  1. action
  2. allow_extra_fields
  3. allow_file_upload
  4. attr
  5. auto_initialize
  6. block_name
  7. by_reference
  8. class
  9. compound
  10. constraints
  11. csrf_field_name
  12. csrf_message
  13. csrf_protection
  14. csrf_token_id
  15. csrf_token_manager
  16. data
  17. data_class
  18. disabled
  19. empty_data
  20. error_bubbling
  21. error_mapping
  22. extra_fields_message
  23. help
  24. help_attr
  25. inherit_data
  26. invalid_message
  27. invalid_message_parameters
  28. label
  29. label_attr
  30. label_format
  31. mapped
  32. method
  33. multiple
  34. post_max_size_message
  35. property_path
  36. required
  37. translation_domain
  38. trim
  39. upload_max_size_message
  40. validation_groups

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.