Skip to content

Instantly share code, notes, and snippets.

@smeevil
Created September 16, 2015 11:51
Show Gist options
  • Save smeevil/7649b617f2bc8ee03f8a to your computer and use it in GitHub Desktop.
Save smeevil/7649b617f2bc8ee03f8a to your computer and use it in GitHub Desktop.
Phoenix hidden field with boolean value
In phoenix when using a hidden field that should contain the value of a boolean with "<%= hidden_input f, :anonymous %>" it renders the following :
When true :
<input id="investment_anonymous" name="investment[anonymous]" type="hidden" value="value">
When false :
<input id="investment_anonymous" name="investment[anonymous]" type="hidden">
I would expect it to render the following :
When true :
<input id="investment_anonymous" name="investment[anonymous]" type="hidden" value="true">
When false :
<input id="investment_anonymous" name="investment[anonymous]" type="hidden" value="false">
Is this intentional or a bug ?
When it is intentional, then how should i handle this ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment