Displaying 20 results from an estimated 4000 matches similar to: "How do I set the default value for date fields?"
2006 Jan 07
4
set date with date_select
when retreiving a date from a DATETIME field in a database, is there a
way to set the date to the value of the DB in the view? It seems to
always default to the current date...
if I have a field called birthdate in the users table and i do
@user = User.find(@params[:id])
in my view i have a <%= date_select ''birthdate'',''user'' %>
but dont know how to
2008 Jan 12
2
Problems with date field
Hi, I''m creating a date type field to put birthdate, but the years on
this field only go to 2003, what should I do??
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To
2006 Jan 19
2
date_select broken
I am using date_select and in some instances it only shows about 10
years worth of choices. Same form on other users shows the whole
range. date_select looks like this
<%= date_select ''user'',''birthdate'' , :start_year => 1940 %>
I would expect to always see 1940-2006 or so , but i dont always do.
Is there a way to force the range or explain why i
2006 Feb 08
6
can''t get date_select to work
Hi,
I render a couple of date_select fields, the HTML looks fine, I can
see the values submitted back to the server, but AR doesn''t pick them
up from the hash in Booking.new(params[''booking'']).
I''ve got a ''booking'' object with parameters product, startdate and
enddate.
HTML snippets:
<select
2007 Oct 13
5
default date for date_select
Hi,
How can I set a default date for a date_select?
I''m trying to do something along the lines of:
<%= date_select("requirement", "target_date", :end_year =>
2020, :discard_day => true, :include_blank => true, :order =>
[:month, :year], :default => {:month => 10, :year => 2012 }) %>
but the default that comes up on the form is blank month
Overriding date_select in local project to use custom value rather than blank for starting option...
2005 May 08
3
Overriding date_select in local project to use custom value rather than blank for starting option...
I would like to have a date control on a page and I would like a
behavior similar to what you get using date_select with the
:include_blank => true option where the first value in the dropdown is
"- Month -", "- Day -", or "- Year -" rather than a blank value for
the respective month, day, and year select fields.
I took a look at the ruby source for
2006 Feb 20
1
extract month from date column
Hi,
I have this rails query:
@birthdays = Birthday.find :all,
:conditions => ["user_id = ? and
birthdate = ''2006-02-01'', @user_id],
:limit => @birthday_pages.items_per_page,
:offset => @birthday_pages.current.offset
You can ignore the user_id, limit and offset part.
2008 Feb 24
3
1 error(s) on assignment of multiparameter attributes
I am trying to create a form for processing credit cards. For the
credit card expiration date, I would like to leave the day field out
of the form for obvious reasons. However, the following code is
producing an error for me.
Any ideas?
Thanks!
<p><label for="email">Expiration</label><br/>
<input type="hidden" id="user_card_expiration_3i"
2006 Jul 15
1
Trouble using date_select with blank options
I want to allow users to enter a day and a month, but not necessarily
a year. i.e. it should be optional.
If I select the day and month, but a blank year and then submit i get:
1 error(s) on assignment of multiparameter attributes
The paramaters regarding the date look like this:
{"date_of_birth(2i)"=>"3",
2006 Jan 06
0
date_select and sessions
i am using date_select to allow someone to select their birthdate in a
form. however date_select uses 3 wierd labels in the forms like
follows:
<select name="user[birthdate(1i)]">
<option value="1940">1940</option>
<option value="1941">1941</option>
.
and then the month is user[birthdate(2i)] and so on. My issue is i
dont know the
2007 Aug 10
2
Select doenst pass the correct value
Hello,
I have in my view a select tag that doesnt return the right value, could
anyone point me what am I doing wrong?
Heres whats in my view
<%=select "", "situacao", {"Open"=>0,"Closed"=>
1},:include_blank=>true%>
Then in my controller I do this
def status
if request.post?
#Do some stuff
@situacao = params[:situacao]
2007 Apr 14
1
how to add class to date_select helper
Hi,
I have this helper and would like to add a html class to each of the
select box''s it generates, however I have been unable to find a way?
<%= f.date_select ''date_of_birth'', :order => [:day,:month,:year],
:start_year => 1940, :end_year => Time.now.year, :include_blank => true
%>
Any suggestions?
thanks
john
--
Posted via
2009 Feb 20
3
mean over previous cells
Dear RUsers,
I guess this is an easy question for someone a little familiar with
programming...(which I am not)...
I've got 2 colummns, one shows just dates(SST_date, Class 'Date' num), the
other one shows the SeaSurfaceTemperature (SST, num) at that certain date.
SST_date SST
2008-01-01 22.2
2008-01-02 21.8
2008-01-03 22.8
2008-01-04 22.9
2008-01-05 23.1
2008-01-06 23.2
...
2006 Jun 16
3
finding out about options
I''ve been to the RoR api docs trying to find out
about options for various methods (mostly for
select helper methods), yet I find no listing of
options even when the method described says
that it takes options. How
can I find out what are valid
options say for a date_select tag?
Thanks,
Dave
2008 Jun 09
3
Rails 2.1 and ddatetime_select
I''ve updated to 2.1 and am continuing to have issues with
datetime_select helpers which worked fine previously.
Example:
<% form_remote_tag(:url => { :controller => ''notes'',
:action
=> :add_booking_note_ajax,
:id => @booking},
2006 Jul 11
5
What are people using for date fields
I''m just curious about what techniques others have successfully used to
capture date data on forms as an alternative to the standard date_select. I
have to admit I''ve been lazy and only used the date_select as we have very
few dates in our system now, but that is about to change. I would like
something better.
Any thoughts?
--
Thanks,
Sam
-------------- next part
2006 Apr 06
6
select method
The documentation states as an example:
select("post", "person_id", Person.find_all.collect {|p| [ p.name, p.id ] },
{ :include_blank => true }) could become:
<select name="post[person_id]">
<option></option>
<option value="1" selected="selected">David</option>
<option
2009 Jul 02
3
Testing for membership in an array of strings
As an R beginner, I feel brain dead today as I can not find the answer
to a relatively simple question.
Given a array of string values, for example lets say "mary", "bob",
"danny", "sue", and "jane".
I am trying to determine how to perform a logical test to determine if
a variable is an exact match for one of the string values in the array
2007 Nov 03
3
Birthdate validation
Hello everyone,
I''m almost cracking my head trying to do this birthdate validation. It
turns out that I can only accept users with at least 18 years old and
I''m trying to validate it writing this code on my user.rb fil at app/
models
class User < ActiveRecord::Base
validates_presence_of :full_name
validates_presence_of :street_address
validates_presence_of :city
2006 May 10
2
Rails, Postgres and the Date Field.
Hi guys,
I''m having problems with my app. First of all, I created a date_select
with the code:
<%= date_select(''contact'', ''birthday'', :order => [''day'',''month'',''year'']) %>
In the contacts table, I create a date field:
birthday DATE
When I save the values goes wrong into the database.