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

Unselected radio group is not present in serialized data #102

Open
stephanebachelier opened this issue Apr 8, 2015 · 5 comments
Open

Unselected radio group is not present in serialized data #102

stephanebachelier opened this issue Apr 8, 2015 · 5 comments

Comments

@stephanebachelier
Copy link
Contributor

Hi,

I've found that if you serialize a form with a radio group with no button checked, the serialize object will not contain any value. I would like to have a different behavior: provide the name (or whatever key is used) of the radio group with an empty value.

I can provide a PR if you are willing to accept this behavior.

@stephanebachelier stephanebachelier changed the title Unselected radio group is not added to data Unselected radio group is not present in serialized data Apr 12, 2015
@rhubarbselleven
Copy link
Contributor

Thanks @stephanebachelier

To include or exclude keys due to the presence of a value is a bit inconsistent in a number of places, thanks for bringing this up. The current behaviour of Syphon is as you described: key with an empty value.

A PR would be fabulous 👍

@stephanebachelier
Copy link
Contributor Author

@rhubarbselleven then I'll come back to you soon :)

@stephanebachelier
Copy link
Contributor Author

@rhubarbselleven it's done. I've added a new registry to Syphon which ValueAssigners. The idea is be able to override for any type how the value is assigned.
I've added lots of tests and you could see in stephanebachelier@b555333#diff-c0efbcd7d0b47db913f31f6b7c75333cR195 a possible usage.

I think the ValueAssigners should helps with #34.

@stephanebachelier
Copy link
Contributor Author

@rhubarbselleven Coming back here. I've updated my PR and rebased on top of master which is the last available.

@ishaikovsky
Copy link

Would love to see it merged. Have exactly same issue with checkbox'es and radio.

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

Successfully merging a pull request may close this issue.

3 participants