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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:50:02+00:00 2026-05-27T21:50:02+00:00

I am trying to create a form which loads upon a user clicking a

  • 0

I am trying to create a form which loads upon a user clicking a date in a calendar, the form then is passed the date that is clicked through the URL and the controller assigns that date to the @date variable. I then create a date_select element and assign it the @date variable. This works fine but since I do not want the user to be able to edit the date in the form I want it to be hidden.

I pass these html options to the form but it doesn’t seem to ever effect the HTML:

<%= f.date_select :date, :default => @date, :type => "hidden" %>

Am I missing something? I also tried passing it in an HTML hash :html => { :type = "hidden" } but that doesn’t work either. Even when I try something different like :class => "something" it doesn’t change the HTML. Is there something special about the date_select helper?

  • 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-05-27T21:50:02+00:00Added an answer on May 27, 2026 at 9:50 pm

    date_select accepts the options discard_day, discard_month and discard_year to do exactly what you are trying to achieve.

    <%= f.date_select :date, { :discard_day => true, :discard_month => true, :discard_year => true } %>
    

    Behind the scenes, it generates the following HTML code:

    <input id="record_date_3i" name="record[date(3i)]" type="hidden" value="5" />
    <input id="record_date_2i" name="record[date(2i)]" type="hidden" value="1" />
    <input id="record_date_1i" name="record[date(1i)]" type="hidden" value="2012" />
    

    No CSS tricks, no changes in your controllers.

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

Sidebar

Related Questions

im trying to create a semi-transparent form which is displayed in a panel. i
I'm trying to create a custom form element which extends Zend_Form_Element_Text with a validator
I'm trying to create a form that has an expandable widget. The problem is
I am trying to create a form in Rails 2.2.2 that populates a field
I'm trying to create a form that based on the users input would determine
Using C#, I'm trying to create a form with a dataGridView that shows the
I'm trying to create a C# form app that will allow me to use
UPDATED QUESTION: I'm trying to create a form which passes subject, content, and a
I'm trying to create an AJAX powered form which checks to see if codes
i'm trying to create form which with which i can upload text and image

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.