Datepicker is not working

27 views
Skip to first unread message

Jaimin Pandya

unread,
Jul 19, 2014, 11:42:14 AM7/19/14
to rubyonra...@googlegroups.com
I am using Ruby 1.9.3 and Rails 3.2.16.

I want to add the datepicker widget to one of my select fields. I have
included 'jquery_datepicker', 'jquery-rails', 'jquery-ui-rails' in
Gemfile.
I am new for JQuery.

>> The form code like as follow:
<div class="field">
<%= f.label :expense_on %><br />
<%= f.text_field :expense_on, :id => "datepicker" %>
</div>

>> Code for application.js :

//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require bootstrap
//= require_tree .


$(function() {
$('#datepicker').datepicker({dateFormat: 'yy-mm-dd'});
});

>> code for application.css:
/*
*= require_self
*= require jquery-ui
*= require_tree .
*/

I am not getting any error.

I attached application.html.erb. Please find it.

How could i fix this problem?

Kind regards.

Attachments:
http://www.ruby-forum.com/attachment/9916/application.html.erb


--
Posted via http://www.ruby-forum.com/.

Jaimin Pandya

unread,
Jul 20, 2014, 12:45:10 AM7/20/14
to rubyonra...@googlegroups.com
I have solved this problem.

Colin Law

unread,
Jul 20, 2014, 3:35:22 AM7/20/14
to rubyonra...@googlegroups.com
On 20 July 2014 05:43, Jaimin Pandya <li...@ruby-forum.com> wrote:
> I have solved this problem.

Thanks for sharing the solution so that others can learn from it.

Colin

Jaimin Pandya

unread,
Jul 20, 2014, 12:54:50 PM7/20/14
to rubyonra...@googlegroups.com
I have solved this problem.

I have changed application.html.erb file. I attached updated file of
application.html.erb, Please find it.

I have add code in **quantities.js.coffee** like as follow:

jQuery ->
$('.datepicker').datepicker()

Kind regards.

Attachments:
http://www.ruby-forum.com/attachment/9917/application.html.erb

Jaimin Pandya

unread,
Jul 20, 2014, 12:56:28 PM7/20/14
to rubyonra...@googlegroups.com
> Thanks for sharing the solution so that others can learn from it.


Thank you for your suggestion. I have shared my solution.

Kind regards.
Reply all
Reply to author
Forward
0 new messages