This project is archived and is in readonly mode.

#503 ✓resolved
Emilio Tagua

Add ignore_date option to date helpers so Rails doesn't hidden field tags

Reported by Emilio Tagua | July 1st, 2008 @ 03:16 PM

Date helpers render hidden input tags so valid dates are created in a form, this is great, but...

Example case: I am using for the same attribute a time_select and a date_select in the same form for design reasons.

form.time_select(:starts_at) will render hidden field tags for day, month and year, so the params are a valid date when parsing them, but in this case i don't want them to be hidden i want to put them somewhere else.

With this patch you could do something like:


<%= form.date_select(:starts_at) %>

<%= form.time_select(:starts_at, :ignore_date => true) %>

Comments and changes to this ticket

  • Emilio Tagua

    Emilio Tagua July 1st, 2008 @ 03:28 PM

    • Title changed from “Add ignore_date option to date helpers so Rails doesn't hidden field tags” to “Add ignore_date option to date helpers so Rails doesn't render hidden field tags”
    • Tag set to actionpack, patch
  • Repository

    Repository July 4th, 2008 @ 02:13 AM

    • State changed from “new” to “resolved”

    (from [570f5aad663fa3113772cf56306862829babc739]) Allow date helpers to ignore date hidden field tags. [#503 state:resolved]

    Signed-off-by: Pratik Naik

    http://github.com/rails/rails/co...

  • Jeremy Kemper
  • Aditya Sanghi

    Aditya Sanghi October 9th, 2010 @ 09:51 AM

    • Title changed from “Add ignore_date option to date helpers so Rails doesn't render hidden field tags” to “Add ignore_date option to date helpers so Rails doesn't hidden field tags”
    • Assigned user set to “Emilio Tagua”
    • Tag cleared.

    Sorry to open up a topic more than 2 years old but it's caused (https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets....

    Just wondering the use case stated here could not have been handled by datetime_select?

    Using time_select with :ignore_date => true causes an errors if the date_select on the same field has not been provided. Moreover, if you enter the time as 01 hours, 02 minutes and 03 seconds, Rails wouldn't even know that its a problem and consider it Year 1, Month 2, Day 3 and NO error would be popped.

    Also the documentation does not state anywhere that if you do indeed use :ignore_date => true, you MUST also remember to use date_select on the same field. After much digging, this is the only place this requirement is stated.

    I would be of the opinion to revert this functionality, please do share your thoughts.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages