Using Calendar_Date_Select with Rails 3

Rails bootstrap datepicker - Calendar is covered by drop down list when adding new record

one of alternatif solution for your problem is to turned off autocomplete field, you can turned off html autocomplete from previous input with this command below

<%= form_for @your_data , :html => {:autocomplete=> 'off'} do |f| %>

Show a date field in rails 3 using a jquery plugin

Include jquery UI in your project and use Jquery Datepicker. Will work like a charm what ever version you are using as its totally Javascript HTML and css. :-)

All you need to do it. Include Jquery Ui in you project which you can download from here and this JavaScript code. You can remove unnecessary features which u don't need.

<script>
$(function() {
$( "#id_of_my_datepicker_text_box" ).datepicker();
});
</script>

How can post parameters month and day in calendar date select tag?

I saw your question and that's so easy, try this:

In your controller:

def sending
##### THIS IS IF YOU HAVE PROBLEMS WITH NIL PARAMS IN CALENDAR TAG
if params[:d1].nil?
@d1 = params[:d1]
else
if params[:d1].present?
@d1 = Date.parse(params[:d1]).strftime("%m-%d")
end
end

if params[:d2].nil?
@d2 = params[:d2]
else
if params[:d2].present?
@d2 = Date.parse(params[:d2]).strftime("%m-%d")
end
end
################

@clients= Client.find(:all,:conditions=>['date_format(happy_birthday,"%m-%d") BETWEEN ? AND ?',@d1,@d2] )
end

In your view:

<% form_tag :controller=>"test",:action=>"sending" do %>
From: <%= calendar_date_select_tag "d1",@d1 %>
TO: <%= calendar_date_select_tag "d2",@d2 %>
<%= submit_tag "Search", :class=>"button" %>
<% end %>

Hope this tips can help.

Input multiple date from a calendar (Ruby on Rails)

You can use below jquery library file

http://dubrox.github.io/Multiple-Dates-Picker-for-jQuery-UI/

Javascript

https://raw.githubusercontent.com/dubrox/Multiple-Dates-Picker-for-jQuery-UI/master/jquery-ui.multidatespicker.js

CSS

https://raw.githubusercontent.com/dubrox/Multiple-Dates-Picker-for-jQuery-UI/master/jquery-ui.multidatespicker.css

include these file into assets

In html

<%= text_field_tag :route_dates, nil, class: "gui-input", placeholder: "Select date" %>

coffescript

date = new Date()
$('#route_dates').multiDatesPicker
addDates: [date, date]
dateFormat: 'dd-M-yy'

bootstrap datepicker calendar is not coming in Rails 3

Add these below files into application-default.js file,

//= require bootstrap-datepicker
//= require bootstrap-datepicker/core
//= require bootstrap-datepicker/locales/bootstrap-datepicker.es.js
//= require bootstrap-datepicker/locales/bootstrap-datepicker.fr.js

Add these below files into application-default.css.scss

*= require bootstrap-datepicker

Change your javascript like,

$('#datepicker').datepicker({
format: "yyyy-mm-dd"
});

To check how to change date format, please look into these bootstrap datepicker and click on Online Demo link on that page.

Rails 4 Bootstrap 3 Date Time Picker - calendar does not show up

move your javascript code in application.js and change it

$(document).on('click', function(){
$('#datetimepicker').datetimepicker({
...
...
});
});

in _form.html.erb

<div class="row">
<div class="col-xs-8">
<%= f.label :appointment_date, "Appointment date", class: 'control-label' %>
</div>
<div class="col-xs-4">
<%= f.text_field :appointment_date, id: datetimepicker', class: 'form-control', placeholder: "yyyy-mm-dd" %>
</div>
</div>

Hope, it helps you!

How to select date from a select box using Capybara in Rails 3?

You need to specify the exact value as it's in the select menu in html. So if your select has values like "2011/01/01" then you need to write:

select '2011/01/01', :from => 'Date of birth'

Your code fails because you pass a date object.



Related Topics



Leave a reply



Submit