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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:01:42+00:00 2026-05-28T02:01:42+00:00

So I am using the form helper to generate my forms. Up until now

  • 0

So I am using the form helper to generate my forms. Up until now it worked just how I wanted it to work, but I stumbled upon the styling of the options of a form_dropdown.
Basically what I am doing right now is populating the dropdown from the database as can be seen in the following example;

// Set up the array for the colors.
$data_colors = array('0'=>'color');
foreach ($search_colors as $color)
{
    $data_colors[$color['color_id']] = $color['name'];
}
echo form_dropdown('color',$data_colors,'0');

Now, the database also got a row called ‘hex’. What I am trying to do is setting the value of hex as background of the option.

Is that even possible or should I go back to manually writing the HTML code of the dropdown on this one?

Thanks.

  • 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-28T02:01:43+00:00Added an answer on May 28, 2026 at 2:01 am

    That seems a little too advanced for the Form Helper’s form_dropdown() function. I can only see the option to give the entire drop down an ID or class and that wouldn’t help since you want to style individual options. So, yes, it’s back to manually making the HTML code for now.

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

Sidebar

Related Questions

I'm trying to generate a form using the form_for helper in RoR but I
$x=array('a','b','c'); echo form::dropdown('test', $x, 'b'); I'm using the Kohana form helper to build forms,
Using CakePHP's form helper to generate a checkbox is easy enough; to use the
I use The MVC3 Helper to generate my Ajax form like this: @using (Ajax.BeginForm(Attended,
i am using form authentication for my website which is written in ASP.Net, but
To avoid reinventing the wheel, I am generating a form using CakePHP's form helper,
Using the form helper in CakePHP 1.3, I'm trying to display a list (drop-down
Using MVC, I have an html form helper in my view: using (Html.BeginForm(ActionOne, ControllerOne))
I am using form helper to create a dropdown menu, I have looked at
i have a form using kohana form helper. in a select field i want

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.