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

  • Home
  • SEARCH
  • 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 8816915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:43:50+00:00 2026-06-14T04:43:50+00:00

Ok so I am working on a project that was outsourced and now I

  • 0

Ok so I am working on a project that was outsourced and now I get to jump in and fix everything before it gets pushed to production. I am currently trying to modify a line that creates a select form field. I read up on some of the different form helper methods to use in ruby, and over some of the available options for the method.

My problem is I can’t seem to figure out how to get a default value to be displayed inside the select element without having it show up in the drop down options. This is what the line currently looks like.

<%= select :profile, :sexual_interest, SEXUAL_INTEREST_ARRAY, {:prompt => 'sexuality'}, {:class => 'selectFull'} %>

I tried changing some of the options using :default => ‘sexuality’ and then tried :disabled => ‘sexuality’. But I seem to only be able to remove the option entirely from the select element or have it as the first value in the drop down list and being displayed as the default value.

If you are just having issues setting the default value of your select field using a ruby form helper, reference this post selecting a default for option field

If any one could give me some insight as to how to fix this issue I would greatly appreciate it. Any ideas would help, Thanks for reading.

-Alan

  • 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-06-14T04:43:51+00:00Added an answer on June 14, 2026 at 4:43 am

    It is not possible to do that in HTML, so you’ll have to use another approach.

    Possible solution

    Suppose you have:

    <select name="selectBox" id="selectBox">
        <option value="default">default</option>
        <option value="option1">option1</option>
        <option value="option2">option2</option>
        <option value="option3">option3</option>
        <option value="option4">option4</option>    
    </select>
    

    Then your javascript will looklike this:

    $("#selectBox").change(function(){
       $("#selectBox option[value='default']").remove();
    }​);
    

    The example on jsFiddle​

    Selectors

    $('#selectBox option[value="SEL1"]')
    

    For an index:

    $('#selectBox  option:eq(1)')
    

    For a known text:

    $('#selectBox option:contains("Selection 1")')
    

    Hope it helps you!

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

Sidebar

Related Questions

I have a working project that Im amending, it crashes after trying to use
I'm working on a project that is trying to use context-free grammars for parsing
I'm working in a project that need to get SVD (Single Values Decomposition) for
I'm working on a project that is currently migrating from Apache Tomcat 6 to
I'm currently working a project that has me working with XML a lot. I
Currently working on a project that is being developed in VS2010. I'm running Windows
I am working on a project that I will get all tweets from a
Currently I am working on project that's supposed to be used by a lot
I'm working on project that lets users choose some scientific authors and columnists and
Im working on a project that has an implementation of JOSSO in place. We

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.