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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:43:19+00:00 2026-05-25T16:43:19+00:00

I have a drop down box in ruby on rails that allows a date

  • 0

I have a drop down box in ruby on rails that allows a date to be entered. And there is a box beside it to indicate that no date will be entered.

When this box is ticked it changes the default value of the date to nil. However the user can still enter a date on the drop down boxes.

When the box is ticked I want the drop down to be readonly or uneditable how can I do this?

EDIT

function BlankOutStartDates() { 
if     (document.getElementById("service_unknown_start_date").checked == true) 
{ 
 document.getElementById("service_start_date_1i").selectedIndex = 0;     
 document.getElementById("service_start_date_2i").selectedIndex = 0;
 document.getElementById("service_start_date_3i").selectedIndex = 0; 
} 
} 

I want to add the addition javascript to make the drop down box read only if the box is ticket

  • 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-25T16:43:20+00:00Added an answer on May 25, 2026 at 4:43 pm

    I would actually do this in jQuery. Suppose your checkbox has class “no-date”, and your select boxes all of the class “date-select”. Then you could do this:

    jQuery(".no-date").change(function(){
       //Check if the box is checked
       if(this.is(':checked')){
          jQuery(".date-select").attr("disabled", "true");
       } else {
          jQuery(".date-select").removeAttr("disabled");
       }
    });
    

    You’ll want to double check “this.is(‘:checked’)” is correct, but I think that will work.

    This uses the “disabled” parameter of select tags: http://www.w3schools.com/tags/tag_select.asp

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

Sidebar

Related Questions

I have a drop-down box in my VB6 form, I was wondering if there
In my rails app, i have a drop down box where i retrieve all
I have the following drop down box in a form for rails: <%= f.select
in my Application i have text box beside it i have drop down control.
We have to insert the Date of Birth(which is a drop down box containing
Hi I have a drop down box that is in the edit template of
I have a drop down list's select tag that looks like this: <select name=MyName
I have a ruby on rails application.I have 2 drop down boxes.I have to
I have a Ruby On Rails application. I want to enable the drop down
I have a problem with this query and drop down box: $ziua = SELECT

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.