Depending on your browser, a normal HTML5 `<input type="date">` (which is what the ERB above creates) will generate a fancy picker, or it may produce a thing that looks like a text field, but behaves differently from one. Regardless how it appears, a "date" input will only accept ISO-formatted dates as its value. Change your value= to '2015-08-01' and it may appear as you expect.
Walter
> On Jul 17, 2016, at 11:40 AM, Padmahas Bn <padmahas@gmail.com> wrote:
>
> Here, you can see the date picker. but the code I used is very basic
>
> <div class="field">
> <%= label_tag("To date") %>
> <%= date_field_tag 'tdate', '2015/08/01', class: 'form-control' %>
> </div>
>
> I didn't worried about it until I tried to set default value and you can see the default value '2015/08/01' is not appearing in the date field.
> It can't be included from JQuery because I removed "//= require jquery" and "//= require jquery_ujs" from "application.js" and still its showing up. Nothing special appears in Gemfile too.
>
> ruby version: 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
> Rails version: 4.2.6
>
> I still don't care if someone know how to force default value to show up.
>
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2e3e75b7-bb92-453a-ac2f-82ea5c079129%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/E7ABDDFD-3A0B-4A18-AE6C-0A3824A6CF4F%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment