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

Option to store/return raw value for dropdown #149

Open
jbreuer opened this issue Sep 28, 2016 · 10 comments
Open

Option to store/return raw value for dropdown #149

jbreuer opened this issue Sep 28, 2016 · 10 comments

Comments

@jbreuer
Copy link

jbreuer commented Sep 28, 2016

We're having a dropdown so only 1 value can be selected. For us it didn't really matter how the value was saved because we needed the raw value. We chose CSV, but some values in our dropdown contain a comma. The values are stored correct in the database, but the dropdown is not populated. If we there is an option to store the value raw this would fix it for us.

We tried changing the stored value from CSV to XML or JSON, but this means we need to resave all content that's using the dropdown which is too much work. So would it be possible to return the CSV without splitting it?

nadeyamalashevich added a commit to nadeyamalashevich/nuPickers that referenced this issue Sep 28, 2016
nadeyamalashevich added a commit to nadeyamalashevich/nuPickers that referenced this issue Sep 30, 2016
@gfyans
Copy link

gfyans commented Mar 6, 2017

Did you guys ever submit this as a PR? We've got the same issue just now, would rather not run with an unofficial version.

@Hendy
Copy link
Contributor

Hendy commented Mar 6, 2017

Hi @gfyans, yes #150

@Hendy
Copy link
Contributor

Hendy commented Mar 6, 2017

instead of a Raw format option (as in the PR) fixing #59 should also resolve this issue

@gfyans
Copy link

gfyans commented Mar 6, 2017

Thanks, Hendy. It was actually a colleague who reported having a problem so I'll check in tomorrow with him and update.

@Hendy
Copy link
Contributor

Hendy commented Mar 6, 2017

Thanks Greg. It would be good to know if it is just commas not being encoded (#59 is more about typeahead)

@Lachlann
Copy link

Lachlann commented Mar 7, 2017

Hi Hendy,
Im Gregs' colleague that is looking into the escaping issue, I had a look at how the values are stored in the umbraco.config and they do not appear to be escaped there:

<schoolTags><![CDATA[[{"key":"School","label":"School"},{"key":"Engineering & Computing","label":"Engineering & Computing"},{"key":"Education","label":"Education"},{"key":"Health, Nursing & Midwifery","label":"Health, Nursing & Midwifery"},{"key":"Media, Culture & Society","label":"Media, Culture & Society"},{"key":"Science & Sport","label":"Science & Sport"}]]]></schoolTags>

We are running 1.5.3 on n Umbraco 7.5.10 install. We are using this data in the nuPickers .NET checkbox picker data type, with values returned as CSV. We are finding that the output of the CSV is splitting items with a comma, so for example 'Health, Nursing & Midwifery' is becoming two items in the CSV: 'Health' and 'Nursing & Midwifery'.

Best
L

@Hendy
Copy link
Contributor

Hendy commented Apr 4, 2017

Hi @Lachlann thanks for the update, looks like the save format above is JSON rather than CSV.
JSON should work, but there is an issue with not escaping commas in CSV #59

@Lachlann
Copy link

Lachlann commented Apr 5, 2017

Hi Hendy,
Yeah we tried setting the save type to json but it would have required too big a reworking of our code so i reverted back, the above must have been a hangover from that.

I have taken fork of the repo and amended it to return escaped label values for the csv save type which seems to work well. not sure if it is something you would be interested in me submitting a pull request for?

best
L

@Hendy
Copy link
Contributor

Hendy commented Apr 5, 2017

Hi @Lachlann, if it fixes #59 then a PR would be wonderful ! Ideally we should follow the CSV spec handling commas by putting the field in quotes (and escaping quotes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants