coloring in combo boxes

coloring in combo boxes

  

Hi All - I need to display on my page like below: But the user should be able to edit it by clicking on it to a different colour.


The best approach I thought would be with the combo boxes (unless someone has better idea) and can fill in the colour in the line items there. So far I tried to achieve this by stylesheets

SyntaxEditor Code Snippet

.StyleOptionRed {background-color:red; color:red}

but this gives me one colour only but I need to show different colors along with this and I need to save it back into the DB as well so that when next time user comes in, it should show their save option.

Any clue how can I achieve this please?

Cheers,
Sandeep Kapil.


I am since trying to achieve this and been doing it for last 5 days and here are other couple of solutions which I have come up with:
first instead of dropdowns I have come up with colour coded buttons and Onclick of that button, i am asking/prompting user which colour it should be changed to as per below: 

SyntaxEditor Code Snippet

"
        var color = prompt('Which color you want to set', 'Green');
        if (color != null) 
        {              
              document.getElementById('"+btnColour.Id+"').style.backgroundcolor=color;
        }

"

But issue with above approach is that I can't save this button's style value into the DB.  So stuck here with this approach. Then I though to change it to the TextBoxes. So I wrote the code like this:

SyntaxEditor Code Snippet

              document.getElementById('"+txtColour.Id+"').style.backgroundColor=color;
              document.getElementById('"+txtColour.Id+"').value = color;

It is good as it is saving the value into the DB (Because I can bind the textbox to the DB and utilize it's value property to insert the record) but when the form is loading for the first time how shall I bind that saved value to the style of the Textbox dynamically , so both of the theories have one flaw and I am not sure how to overcome it as I am running out of ideas here.


Anyone any clue about m y problem, please help.


hey guys - I used nested If's to sort out my issue with the below code, anyway am all good now :-). Thank you if you have looked at my issue. 

SyntaxEditor Code Snippet

If(ContactForm.Record.Contact.RoadMap = "Current","background-color:Lightgreen;",If(ContactForm.Record.Contact.RoadMap = "Retire","background-color:pink;",
If(ContactForm.Record.Contact.RoadMap = "TBC","background-color:White;","background-color:LightYellow;")))