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

have select field support both key and display value #25

Open
petri opened this issue Oct 7, 2015 · 0 comments
Open

have select field support both key and display value #25

petri opened this issue Oct 7, 2015 · 0 comments

Comments

@petri
Copy link
Member

petri commented Oct 7, 2015

For select field, the table cell value is used to fill both the select option element value attribute and the option tag content itself. As in:

<select name="select">
  <option value="cellvalue">cellvalue</option> 
</select>

This makes it hard to implement a new custom field for which the stored value and display value should be different. Say, a lookup field that stores the uuid of another content object but displays for example its Title.

This seems to me to require that we for example:

  • design a format for specifying (key, displayvalue) vocabularies; say, separate key & display value by pipe ('|') character (or something else)?
  • for backwards compatibility, have the vocabulary method return (vocabulary) value + pipe char + value if the vocabulary item does not contain a pipe char
  • change the view & edit templates to handle both key & display value

It would be perhaps better if (key, displayvalue) tuples were used rather than keeping to a (pipe-separated) string. But that requires additional changes to validator and catalog code and perhaps somewhere else so I'd prefer the simpler option suggested here.

I need this, so would be happy to implement (have a monkeypatched proto working). But I wonder if I have missed something here...?

@petri petri changed the title have select field store both key and display value have select field support both key and display value Oct 7, 2015
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

No branches or pull requests

1 participant