0
我不知道什么是错,但即使我在我的领域:scheduled_date
未来日期,轨道验证与不能为空。实际上,该字段只验证未来的日期和空白字段,但如果我输入当前日期和过去的日期,则没有问题。谢谢!bootstrap-datepicker用“不能空白”验证未来日期 - Ruby on Rails
已更新!
这是我的模型:
registration.rb
validates :scheduled_date, presence: true
HTML文件:
<%=f .label :scheduled_date, 'Date of Appointment:', class: 'control-label' %>
<div class="datepicker input-group">
<%=f .text_field :scheduled_date, class: 'form-control', data: { format: "MM/dd/yyyy" } , placeholder: "Select date" %>
<span class="input-group-addon">
<span data-date-icon="icon-calendar" class="icon-calendar"></span>
</span>
</div>
你能发表一些相关的代码吗?你的模型'validations'和''scheduled_date'的输入将会非常有用。 – Pavan
你给''scheduled_date'字段的样本输入是什么? – Pavan
就像2014年6月25日(这是未来日期),如果我提交,它将验证不能为空 – BartSabayton