forms - Rails can placeholder text be submitted? -
forms - Rails can placeholder text be submitted? -
can't find reply anywhere in docs... there way create placeholder value number_field_tag
or whatever value submitted value
if user doesn't come in else?
i.e., in code below:
<%= number_field_tag "transaction[][#{thing}]", :quantity, min: 0, placeholder: @transactionparams ? @transactionparams["#{thing}"] : 0 %>
i equation in placeholder evaluate , posted if user doesn't come in else.
thanks!
html
the issue html, not rails
the problem placeholder there give text that's visible when input has no value:
the placeholder attribute specifies short hint describes expected value of input field (e.g. sample value or short description of expected format).
the short hint displayed in input field before user enters value.
this attribute (placeholder) not store info in input, meaning when submit form, it's not going send backend. prepare this, should should switch using placeholder
value
attribute:
<%= number_field_tag "transaction[][#{thing}]", :quantity, min: 0, value: @transactionparams ? @transactionparams["#{thing}"] : 0 %>
ruby-on-rails forms twitter-bootstrap ruby-on-rails-4 form-helpers
Comments
Post a Comment