Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9004207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:51:03+00:00 2026-06-16T00:51:03+00:00

I’m trying to use the Bootstrap Datepicker on a form I’m creating. I’ve read

  • 0

I’m trying to use the Bootstrap Datepicker on a form I’m creating. I’ve read through the documentation here: https://github.com/Nerian/bootstrap-datepicker-rails/issues/11 and followed it (or so I thought), but I’m stuck.

Gemfile:
gem 'bootstrap-sass', '2.0.4'
gem 'bootstrap-datepicker-rails'

app/assets/javascripts/application.js

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

app/assets/javascripts/orders.js.coffee (I converted the javascript to CoffeeScript)

$("[data-behaviour~='datepicker']").datepicker(
  format: "yyyy-mm-dd"
  weekStart: 1
  autoclose: true
).on "changeDate", (e) ->

app/stylesheets/application.css.scss

 *= require_self
 *= require bootstrap-datepicker
 *= require_tree .
 */

The form (the relevant part, anyway):

<%= form_for [@user, @order] do |order_form| %>

  <%= order_form.label "When would you like us to pick up your stuff?" %>
  <%= order_form.text_field :order_date, placeholder: "yyyy-mm-dd", 'data-behaviour' => 'datepicker' %> 

<% end %>   

When I go into the console, I can call the datepicker() method on an element and manipulate its properties from there. But, for whatever reason, it’s not working when the page loads. And there aren’t any errors in the console.

(based on what I read here: Twitter bootstrap datepicker is not working in rails, I tried the require_self thing and putting the javascript in the application.js file, too. It didn’t work and I didn’t like the idea of having javascript in the application.js file anyway…)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:51:06+00:00Added an answer on June 16, 2026 at 12:51 am

    I was unsuccessful in integrating Twitter Bootstrap Datepicker with my application. Instead, I used a standard jQuery datepicker and picking a theme that matched my application. My code ended up looking like this:

    In the form:

    <%= order_form.label "When would you like us to pick up your stuff?" %>
    <%= order_form.text_field :order_date, id:"datepicker" %>
    

    The coffeescript:

    $ ->
      $("#datepicker").datepicker({
        minDate: +1,
        dateFormat:"yy-mm-dd"
      })
    

    I added this line to the top of my custom.css file (before the @import bootstrap line)

    @import url(http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css);
    

    in application.css.scss (notice I removed require_bootstrap-datepicker)

     *= require_self
     *= require_tree .
     */
    

    And I removed the gem from my gem file.

    I don’t know how different the Twitter Bootstrap datepicker would have looked, but this theme worked perfectly for my application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to loop through a bunch of documents I have to put
Basically, what I'm trying to create is a page of div tags, each has
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am confused How to use looping for Json response Array in another Array.
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.