Crown-Commercial-Service/digitalmarketplace-frontend-toolkit

Cannot post falsey value using radio buttons

benvand opened this issue · 2 comments

https://github.com/alphagov/digitalmarketplace-frontend-toolkit/blob/master/toolkit/templates/forms/selection-buttons.html#L73

This means that if we set a value of 0 or false then the frontend will post the label rather than the value.

This caused a bug here:
https://github.com/alphagov/digitalmarketplace-supplier-frontend/blob/6521869b79ffff5cb2eed3e64809d6709c3f9776/app/templates/frameworks/reuse_declaration.html#L59-L59

Where the name or the inline radio buttons were 'Yes' and 'No' and the value 1 or 0

Talked about this with Ben IRL.
I suggested that he try the 'boolean' macro instead of the 'radios' one with boolean labels.
He said he's got a workaround in place in case that doesn't work.

It seems like skipping falsey values isn't something we expected to happen -- like it should be okay to set an <input type="radio" value="0"> -- so this should probably be fixed regardless.

@benvand! Pull request #304 fixed this issue!!

giphy