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 8661257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:27:15+00:00 2026-06-12T16:27:15+00:00

I have a rails app with the simpleform and bootstrap-datepicker-rails gems. I try to

  • 0

I have a rails app with the “simpleform” and “bootstrap-datepicker-rails” gems.

I try to make the view code more readable like this:

f.input :birthday, :mydatefield, :options => {:icon => "calendar", :data-date => "21.12.2012", :data-format => "dd-mm-yyyy"}

At this moment I write this:

<div class="input-append date" id="user_birthday" data-date="12-02-2012" data-date-format="dd-mm-yyyy">
    <%= f.input_field :birthday, :disabled => true %>
    <span class="add-on">
        <i class="icon-calendar"></i>
    </span>
</div>

or this

<%= f.input :birthday, :wrapper => :datepicker, :wrapper_html=> {id: "user-birthday", class: "date"} do %>
    <%= f.input_field :birthday, :disabled => true %>
    <%= content_tag :span, :class => "add-on" do %>
        <%= content_tag :i, :style => "color:grey", :class => "icon-calendar" do
        end %>
    <% end %>
<% end %>

to get my result:

Simpleform with bootstrap icon and datepicker

Both of above are making this result, which works well:

<div class="control-group string required date" id="user-birthday">
    <label class="string required control-label" for="user_birthday"><abbr title="required">*</abbr> Birthday</label>
    <div class="controls">
        <div class="input-append">
            <input class="string required disabled" disabled="disabled" id="user_birthday" name="user[birthday]" size="50" type="text" />
            <span class="add-on">
                <i class="icon-calendar" style="color:grey"></i>
            </span>
        </div>
    </div>
</div>

When I try to parse variables to the wrapper

:wrapper_html=> => {:data-date => "21-12-2012"}

it throw errors…

What I have to do? I am quite new on extending gems.

What I have to write to get this working?

  • SimpleForm Wrapper?
  • app/inputs/datepickerInput.rb?
  • initializer/datepicker.rb?
  • Helper Method?

An example will be VERY helpful!

Many thanks in advance!

  • 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-12T16:27:16+00:00Added an answer on June 12, 2026 at 4:27 pm

    I have switched back to the rails implemented forms. For me (as a beginner) simple_form seems not to be clear enough.

    For my solution above I created a FormBuilder:

    class BootstrapFormBuilder < ActionView::Helpers::FormBuilder
    
      def birthday_field_with_hint_and_icons (name, *args)
        options = args.extract_options!
        birthday_field_icons(name) + hint(options[:hint])
      end
    
      def birthday_field_icons(name, *args)
        dd = 'data-date'
        ddf = 'data-date-format'
        content_tag :div, class: "input-append date", dd => 18.years.ago.strftime("%d-%m-%Y"), ddf => "dd-mm-yyyy", id: "user_birthday" do
          text_field(name, :disabled => 'disabled') + icon("icon-calendar")
        end
      end
    
      private
    
      def icon(icon)
        content_tag :span, class: "add-on" do
          content_tag :i, style: "color: grey;", class: icon do
          end
        end
      end
    
      def hint(hint)
        content_tag :span, class: "help-block" do
          hint
        end
      end
    end
    

    Thanks for your help!

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

Sidebar

Related Questions

I'm using the Simpleform gem for my rails app and I have a form
I have a rails app, where Im having a drop box like feature-set. Each
I have a Rails app and trying to make a remote form, so far
In my Rails 3 app I have a simple form like: <%= form_tag({:controller =>
I have rails app with a textarea form like <%= form_for Comment.new, :remote =>
I have a rails app doing facebook invite. I use javascript code for that
I have a rails 3.2 app using Twitter Bootstrap via the gem ' twitter-bootstrap-rails
We have a very simple use of datepicker in rails 3.1.3 app with jquery.
I have rails app which are working perfectly in the local computer. But when
I have a Rails app running Mongoid on Heroku and I need to set

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.