Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion How to use start_year and end_year on a date column
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Lance Ivy  
View profile  
 More options Apr 17 2007, 12:09 pm
From: "Lance Ivy" <la...@cainlevy.net>
Date: Tue, 17 Apr 2007 09:09:58 -0700
Local: Tues, Apr 17 2007 12:09 pm
Subject: Re: How to use start_year and end_year on a date column

we added a :name option to the date/time selects so that you can use the
provided input_name. try:

select_date :record, :name => input_name, ...

On 4/17/07, Vorik <goo...@gerapeldoorn.nl> wrote:

> I'm a bit further. Now I'm using (in the helper)

> select_date record[:geboortedatum], :prefix =>
> 'record_geboortedatum', :order => [:day, :month, :year], :start_year
> => 1970, :end_year => 2000

> This makes the code for the select like this (note the name field):
> ---------------%<---------------
> <select id="record_geboortedatum_day"
> name="record_geboortedatum[day]">
> ---------------%<---------------

> Without the override in the helper (which does save the values in the
> DB):
> ---------------%<---------------
> <select id="record_geboortedatum_1i" name="record[geboortedatum(1i)]">
> ---------------%<---------------

> My code gives the value in a hash (record_geboortedatum[day]). It
> SHOULD give the value back in a hash(?) which is itself in the record
> hash. (record[geboortedatum(1i)])

> How can I achieve this little miracle???

> Greetings & Salutations,
> Ger.

> On 17 apr, 09:30, Vorik <goo...@gerapeldoorn.nl> wrote:
> > Thanks for the tip Lance, but I'm not there yet.... This is what I've
> > come up with:

> > ---------------leerling_helper.rb---------------
> > module Admin::LeerlingHelper
> >   def geboortedatum_form_column(record, input_name)
> >    select_daterecord[:geboortedatum], :name =>
> > 'geboortedatum', :order => [:day, :month, :year], :start_year =>
> > 1970, :end_year => 2000
> >   end
> > end
> > ---------------/leerling_helper.rb---------------

> > The override is beiing used (order changed), but the values are not
> > beiing stored to the database.

> > I think it is because of the select's name. Here is an excerpt of the
> > html-source that is generated:
> > ---------------%<---------------
> > <label for="record_geboortedatum">Geboortedatum</label>
> > <select id="date_day" name="date[day]">
> > <option value="1">1</option>
> > <option value="2">2</option>
> > ---------------%<---------------

> > Shouldn-t that be name="geboortedatum[day]"?

> > how can I change it?

> > Many thanks,
> > Ger.
> > On 16 apr, 20:30, "Lance Ivy" <l...@cainlevy.net> wrote:

> > > Hi Ger,

> > > Your best bet here is probably to override the column on the form and
> > > customize it exactly how you want it. Check
> outhttp://activescaffold.com/docs/form-overrides.

> > > On 4/15/07, Vorik <goo...@gerapeldoorn.nl> wrote:

> > > > Hi all,

> > > > I'm trying to insert a record containing a birthdate with
> > > > activescaffold. However, the year-dropdown box is only showing years
> > > > starting from 2002. This means that people over 5 years old cannot
> use
> > > > the application which, unfortunately, does not meet the functional
> > > > requirements. (Would save lots of difficult questions though!)

> > > > How can I set the starting year? With standard rails it is set like
> > > > this:

> > > > date_select :geboortedatum, :order =>
> > > > [:day, :month, :year], :start_year => 1970, :end_year => 2000

> > > > The funny thing is that in 'edit mode', the years start at 1969 but
> in
> > > > 'new' mode it starts at 2002.

> > > > Thanks in advance,
> > > > Ger Apeldoorn


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.