Giter VIP home page Giter VIP logo

Comments (6)

Gregwar avatar Gregwar commented on July 1, 2024

I agree that property can be confusing, maybe this can be called identifier ?

This type is hidden by default, you have to set it to visible explicitly by passing hidden to false (see getDefaultOptions).

And it make sense to have it as a text field sometimes, think of an "recipient" field, you could directly type the other user login and the form would select the corresponding user directly using this type

from formbundle.

asm89 avatar asm89 commented on July 1, 2024

identifier would be better I think. :)

I see the use case for the current text option and I guess it should be kept. Adding another option for "hidden + visible label containing the info derived from the 'property' option" would be nice I think? It makes it possible to add items + descriptions with a label easily when doing autocomplete + rendering the entity_id type with a label when editing a form?

I currently use entity_id to render a collection of entities that get added / deleted by with javascript/autocomplete.

from formbundle.

Gregwar avatar Gregwar commented on July 1, 2024

@asm89, I understand your use case, and I got almost the same (uploading file and rendering the original file name in a box «something.jpg» while the image id is hidden), but there is two problem then :

  • That would assume that JS UI update the property in the same time as the entity id
  • That implies doing custom field rendering for this case because we would have two sub-fields (the «label» and the identifier) which would complicate the PR on symfony (I'm not sure of how do this without changing the div_layout.html.twig)

from formbundle.

asm89 avatar asm89 commented on July 1, 2024

The first thing you mention is an implication of the fact that you use the 'hidden + label option' and not a problem I think. You probably have the text for the label available anyway because that's usually what the user clicks on in the autocomplete? Updating the value + label won't be a problem. You can still use the current options if they will be kept.

I think it would be ok to enable a label to be rendered in the current 'hidden' type.

from formbundle.

Gregwar avatar Gregwar commented on July 1, 2024

And the «label» should be a text field ?

In this case I need to change the way that the field works, adding two sub-fields (for instance identifier and label); where label should be a text field and identifier an hidden value (so the end-user would just see a single field)

I'm not very happy with this approach, I think this is very specific and the label is part of the JS UI, if you have better idea (or if you want to do a PR on this repo) i'm interested in it

My other problem is that my PR on the official symfony repository was not very discussed by repository contributors and the more feature I'll add the more it will be complicated to argue

from formbundle.

asm89 avatar asm89 commented on July 1, 2024

I think one of the usecases of this form type is to use it with JS and autocomplete? So adding the label with a description of the hidden type makes sense I think. The text for the label should be determined in the same way as the entity type does now. With this logic in place you can re-render the form with descriptions for your entities etc.

I'll look into what I can do. I'm not sure if the "core" type rendering would have to be adjusted to render a label next to the hidden field.

I agree with you that there is little feedback on your PR, you can try to put it up for discussion another time and hang around IRC a bit?

from formbundle.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.