Select list based on color

Hi there
I need to create a static select list in a tabular form with the following values: Red, Amber, Green.
However, instead of the color names, the user wants to see the actual colors in the the select list (changing background color for each option), so it is easy to spot the problematic ones (Red). Is this possible to be done using Apex 3?
Thanks
Luis

Luis et al.
Thanks for posting code to this forum, it has been a great help. I must admit that I know nothing about javascript (close enough to nothing) but through the great posts here I have been able to get the first part working and my list values change color when the page loads. However, when I use the select list I don't know how to implement the code Luis posted to change the background color in the select lists. Any further direction would be a great help.
I have the example page here:
http://apex.oracle.com/pls/otn/f?p=37008:18
and this is the code I used so far in the HTML HEADER on the page:
<script type="text/javascript">
function setAll()
obj=document.forms[0];
len=obj.elements.length;
for (i=0;i<len;i++){
if (obj.elements.name=="f04")
setColor(obj.elements[i]); }
function setColor(sel)
var obj=sel;
if (obj.value=='GREEN')
obj.style.backgroundColor= "green";
if (obj.value=='YELLOW')
obj.style.backgroundColor= "yellow";
if (obj.value=='RED')
obj.style.backgroundColor= "red";
if (obj.value=='WHITE')
obj.style.backgroundColor= "white";
</script>
Thanks again,
Dave

Similar Messages

  • Problem writing a sql query for a select list based on a static LOV

    Hi,
    I have the following table...
    VALIDATIONS
    ID          Number     (PK)
    APP_ID          Number     
    REQUESTED     Date          
    APPROVED     Date          
    VALID_TIL     Date
    DEPT_ID          Number     (FK)
    I have a search form with the following field item variables...
    P11_DEPT_ID (select list based on dynamic LOV from depts table)
    P11_VALID (select list based on static Yes/No LOV)
    A report on the columns of the Validations table is shown based on the values in the search form. So far, my sql query for the report is...
    SELECT v.APP_ID,
    v.REQUESTED,
    v.APPROVED,
    v.VALID_TIL,
    d.DEPT
    FROM DEPTS d, VALIDATIONS v
    WHERE d.DEPT_ID = v.DEPT_ID(+)
    AND (d.DEPT_ID = :P11_DEPT_ID OR :P11_DEPT_ID = -1)
    This query works so far. My problem is that I don't know how to do a search based on the P11_VALID item - if 'yes' is selected, then the VALID_TIL date is still valid. If 'no' is selected then the VALID_TIL date has passed.
    Can anyone help me to extend my query to include this situation?
    Thanks.

    Hello !
    Let's have a look at my example:create table test
    id        number
    ,valid_til date
    insert into test values( 1, sysdate-3 );
    insert into test values( 2, sysdate-2 );
    insert into test values( 3, sysdate-1 );
    insert into test values( 4, sysdate );
    insert into test values( 5, sysdate+1 );
    insert into test values( 6, sysdate+2 );
    commit;
    select * from test;
    def til=yes
    select *
      from test
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);
    def til=no
    select *                                                                               
      from test                                                                            
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);  
    drop table test;  It's working fine, I've tested it.
    The above changes to my first idea I did because of time portion of the DATE datatype in Oracle and therefore the wrong result for today.
    For understandings:
    1.) TRUNC removes the time part of DATE
    2.) The difference of to date-values is the number of days between.
    3.) SIGN is the mathematical function and gives -1,0 or +1 according to an negative, zero or positiv argument.
    4.) DECODE is like an IF.
    Inspect your LOV for the returning values. According to my example they shoul be 'yes' and 'no'. If your values are different, you may have to modify the DECODE.
    Good luck,
    Heinz

  • Creating a dynamic Selection List based on a View Object

    Hello,
    I'm new to JDeveloper and I would like to create a JSP Page with dynamic Selection List based on a runtime query or based on a view object (BC4J). The selection made by an user should serve another dynamic query with the necessary parameters that I built using createViewObjectFromQueryStmt(). By now I tried this using the InputSelectLOV from the Component Palette in JDeveloper. But without success. By the way: the selection list is not very large (5 values), so it's not necessary to have a form finding the desired value.
    Maybe someone had experience about creating this already. Please give me a tip or a little example.
    Thanks.

    http://otn.oracle.com/products/jdev/howtos/jsp/renderers.html

  • Select list based on LOV - and allowing new values

    Hi All,
    I have a page that has a select list based on a dynamic list of values. I wanted to test out how the system was working, so I truncated all of my tables, and now my select list is blank (which makes sense). The problem is that I can't type anything into the select list. How can I make it so that if there isn't a value returned from the query that populates the LOV, I can just type one in? This also goes further in that if the value I wanted isn't already in the db, how does the user add in another value?
    Thanks in advance,
    Corey

    Hello,
    Well as you now know HTML based select lists don't work like that, that widget is called a combo box and there will be built in combo boxes in APEX 3.0, it's a fairly complex dhtml widget.
    What you might want to do is provide a text item next to your select box and an Add New Value Option in your select list.
    Carl

  • Select List (based on LOV) query problem

    Hello experts! I have a small problem here, which I can't seem to overcome.
    I have a page item (select list based on LOV), which is based on a query. The query returns all potential employees of a department that are responsible for a certain duty. So far so good!
    The problem is that there are two departments, which should not only see there own employees but also the name of the employee that has carried out a certain task. However, due to my query, the name of that person is not displayed - only the pk is returned.
    Do you have a recommendation how I display all employees of a specific department and have additional values translated as well?
    My query is as follows: select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter where cnt_bearbeiter in (SELECT
    CNT_REGIERUNGSBEZIRK FROM TBL_REGIERUNGSBEZIRK) union select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter where int_behoerde in (SELECT
    CNT_REGIERUNGSBEZIRK FROM TBL_REGIERUNGSBEZIRK where STR_REGIERUNGSBEZIRK = lower (:app_user)) whereas :app_user holds the information of the department.
    Any hint is appreciated!
    Many thanks,
    Seb

    Okay, I just had the right idea and it's working well! Sorry for posting!
    I return the name of the employee that has edited a dataset and simply add all others of the logged on department! Really easy! Should have thought of that before posting! ;-(
    The correct code is select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter a, vt_tbl_punktdaten b where a.cnt_bearbeiter = b.int_bearbeiter and
    inv_pt_id_sub = :P4_PTIDS
    union select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter where int_behoerde in (SELECT
    CNT_REGIERUNGSBEZIRK FROM TBL_REGIERUNGSBEZIRK where STR_REGIERUNGSBEZIRK = lower (:app_user))Bye,
    Seb

  • Order in a Select List based in a LOV is wrong

    I have a select list based upon a LOV SQL Query.
    Values in table are:
    FIELD
    001
    002
    003
    AAA
    when I make query in SQL Workshop:
    select FIELD from TABLE order by FIELD;
    I get
    001
    002
    003
    AAA
    But when I make a similar query in LOV the result is in the select list
    AAA
    001
    002
    003
    Someone knows what is happening?
    Thank
    Ander

    mhichwa wrote:
    It looks like your application is running a different sort / NLS preference then is the SQL workshop. Is there a chance your application identifies a language that sorts differently then default APEX. I am just guessing but it could explain this behavior.OK, I think something like this is happening because my Oracle instance have SPANISH like a NLS_LANG parameter, but why is different result between sql Workshop and LOV query, I have installed english and spanish languages in my apex instance, I get the same problem in both cases.
    Other curious think is that my min and max values are OK,
    for example
    BETWEEN: <select list 1> AND <select list 2>
    default value for <select list 1> is
    DECLARE
    exitvalue varchar2(10);
    BEGIN
    select min(FIELD) into exitvalue
    from TABLE
    return (exitvalue);
    END;
    I get 001
    default value for <select list 2> is
    DECLARE
    exitvalue varchar2(10);
    BEGIN
    select max(FIELD) into exitvalue
    from TABLE
    return (exitvalue);
    END;
    I get AAA
    But select list are ordered like
    AAA
    001
    002
    003
    I have based select list in a lot of different sql ways
    select FIELD from TABLE ORDER BY FIELD
    select FIELD from TABLE ORDER BY 1
    select FIELD from TABLE ORDER BY FIELD ASC
    select FIELD from TABLE ORDER BY 1 ASC
    Other extraneous think is that I use DESC order I get
    003
    002
    001
    AAA
    Thanks
    Edited by: user10999912 on 24-Jul-2010 08:07

  • Dynamic Select List based on TextField data

    Hi,
    I like to dynamically display the select list based on the value in the textfield, the data in the textfield is of character type.
    Thanks

    Hello,
    Well as you now know HTML based select lists don't work like that, that widget is called a combo box and there will be built in combo boxes in APEX 3.0, it's a fairly complex dhtml widget.
    What you might want to do is provide a text item next to your select box and an Add New Value Option in your select list.
    Carl

  • Populate a select list based on sql query

    I need to populate a select list using an sql query based on the value value I get from the previous page sent using link . How can I achieve this behaviour ? I tried giving select app_item_id a,app_item_id b from app_item_definition where app_id = :P11_APP_TDL_ID order by 1 in LOV, but it doesn't work . Please advice .

    Okay, I just had the right idea and it's working well! Sorry for posting!
    I return the name of the employee that has edited a dataset and simply add all others of the logged on department! Really easy! Should have thought of that before posting! ;-(
    The correct code is select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter a, vt_tbl_punktdaten b where a.cnt_bearbeiter = b.int_bearbeiter and
    inv_pt_id_sub = :P4_PTIDS
    union select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter where int_behoerde in (SELECT
    CNT_REGIERUNGSBEZIRK FROM TBL_REGIERUNGSBEZIRK where STR_REGIERUNGSBEZIRK = lower (:app_user))Bye,
    Seb

  • Select List based on in-line query

    Hello everyone, im having a problem creating a select list with the following query:
    select result.A d, result.B r
    from dual,
    (select RMF.nome A, RMF.chapa B
    from
    medfa_marco_has_colaborador MC,
    medfa_projeto_has_colaborador MP,
    rm_funcionario RMF
    where
    MC.mar_id = :P3_SELECT_MARCO and
    MC.pro_col_id = MP.pro_col_id and
    MP.chapa = RM.chapa) result
    but i keep getting the
    "LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query."
    Thnx in advance.
    E.R

    Okay, first off - does this work in SQL Workshop?
    Have you got a semi-colon at the end of the query (you shouldn't have)?
    Also when posting code put {noformat}{noformat} before and after your code to preserve formatting and spacing.
    Cheers
    Ben
    http://www.munkyben.wordpress.com
    +Don't forget to mark replies helpful or correct+ ;)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Dynamic values of a select list based on a column

    Is there an easy way to build the values of a select list from a column that contains 'Red,Green,Blue" where Red, Green, Blue will be the values of the select list?

    Bob,
    Next time you could try this for a one row table:
    WITH DATA AS
         (SELECT     SUBSTR (txt
                            , INSTR (txt, ',', 1, LEVEL) + 1
                            ,   INSTR (txt, ',', 1, LEVEL + 1)
                              - INSTR (txt, ',', 1, LEVEL)
                              - 1
                            ) AS token
          FROM       (SELECT ',' || YOUR_COLUMN || ',' txt FROM YOUR_TABLE)
          CONNECT BY LEVEL <=
                          LENGTH (txt)
                        - LENGTH (REPLACE (txt, ',', ''))
                        + 1)
    SELECT *
    FROM   DATAOr use this if your comma separated values are in more than one row:
    http://blogs.ittoolbox.com/oracle/guide/archives/sql-question-pivots-analytics-and-the-judicious-use-of-row_number-10156

  • Select List based on other select List

    Hi
    I have 2 select lists when a selection is made in one I want the second list to be limited but when nothing is selected in the first list I want the second list to display all. Apolgies if this is really a plsql thing .
    Heres what I have so far
    if :P52_ORGNAME is null
    then
    return 'select unique surname d,id r from com_contact';
    else
    return 'select unique forename||surname d,id r from com_contact where orgname = :P52_ORGNAME order by id';
    end if;
    the else is fine but I cant get the null condition to work.
    :P52_ORGNAME is a select list where show null is yes and there is no NULL value
    thanks in advance
    Kirk

    Hi,
    you can try 2 things.
    1)try putting a null display value and keep null return value as blank. dont put any value in the default value also,and see if this works,
    2)else try putting a null return value(like BLANK) and check for that value in the condition insted of null. i.e
    if :P52_ORGNAME ='BLANK'
    then
    return 'select unique surname d,id r from com_contact';
    else
    return 'select unique forename||surname d,id r from com_contact where orgname = :P52_ORGNAME order by id';
    end if;
    Hope it works..

  • How to do dependent select list based on parent select list

    Hello... I have the following bit of code...
    *parent select
    htmldb_item.select_list_from_query(1,null,'select program_desc_eng, program_id from myfps_programs')
    * child select using parent value
    htmldb_item.select_list_from_query(2,null,'select sub_pgm_desc_eng, sub_program_id from myfps_sub_programs where program_id = <VALUE FROM ABOVE?>')
    I know this is easily done using the select list form items and such but I need to use the htmldb_item function. On screen when a user selects value from the parent select list, I want the child select list to use the value of the parent as a parameter into its own select list. How can I reference the parent? (ie can I use htmldb_application.g_f01(1) or something of this nature?) I realize I may need a bit of javascript to have it work correctly but I'm just wondering if its possible?

    This is not a trivial task.
    See http://forums.oracle.com/forums/thread.jspa?messageID=1241356

  • How to populate 'Select List' based on Radiogroup selection?

    Hi,
    I've a Radiogroup and on the selection of any of its item, I've to populate a 'Select List' from DB, what is the best way to do this?
    I'm on APEX 2.1.0.00.39, and the Radiogroup & Select List are part of a Form Region.
    To be honest, I don't even know whether to use Radiogroup with submit or redirect :-)
    Thanks for the help,
    -Hozy

    Hi,
    I have never worked on ver 2 of APEX so i dont know wheter these functionality will work or not..
    Option 1)
    1) Make the Radiogroup as Radiogroup(with submit)
    2) Create a select list with query something similar to
    select display_value d , return_value r from myTable where someColumn = :P1_MY_RADIO_BUTTON;
    Option 2) Use AJAX.. htmldb_Get()
    Regards,
    Shijesh

  • Disable Select List based on Button

    I'm a newbie to APEX and I'm trying to disable a Select List only when an onClick action happens in a button(Create New). Otherwise the Select List should be enabled. I know I should be using JavaScript to perform this, but have no clue where to/how to start. Can any of you guide me to any useful threads or perform examples?
    Workspace :SVENKAT
    User ID :[email protected]
    Password :lemope
    I appreciate any help. Thanks!!!
    Shaan

    Shaan:
    You should check out the demo application that is present in your workspace. The application exercises the basic features of APEX and is a good starting point for somebody that wants to learn APEX. For your particular need you should look at page 2 of the demo application. This page uses the 'Report/Form' APEX wizard. As you will see it allows you to 1) List all customers 2) Create a new customer 3) Update an existing customer 4) Delete an existing customer. All these features are implemented using a simple user interface(UI). The UI you have come up with is actually cumbersome and not very intuitive IMO. Take a few moments to get familiar with the demo application. Hopefully it will help you realize the shortcomings of the UI proposed by you. :)
    http://apex.oracle.com/pls/otn/f?p=25444:2
    Login as admin/svenkat
    Varad

  • Dynamic selection list based on selection screen values ?

    I have a requirement which I can't solve in one step in a selection screen
    first field I have to select the contract like you do with me33k
    in the second field I have to select the position of the contract filled in at the first field ?
    if the position is selected I have to fill other fields in the selection screen and block them for altering the information entered by the position selected
    anybody got some sample on how to do this ??
    kind regards
    arthur de smidt

    I really don't understand why it's not working. after input of the parameter field debugging doesn't start when is it evaluated ??
    I want the screen modified at every change of p_contr.
    SELECTION-SCREEN: BEGIN OF BLOCK s01 WITH FRAME TITLE text-s01.
    parameters:       p_bukrs like ekko-bukrs MEMORY ID BUK obligatory,
                      P_WERKS like EKPO-WERKS MEMORY ID WRK OBLIGATORY,
                      p_ekorg like ekko-ekorg MEMORY ID EKO obligatory,
                      P_EKGRP like EKKO-EKGRP MEMORY ID EKG OBLIGATORY.
    SELECTION-SCREEN: END OF BLOCK s01.
    SELECTION-SCREEN: BEGIN OF BLOCK s05 WITH FRAME TITLE text-s05.
    parameters:       p_contr AS CHECKBOX USER-COMMAND contr,
                      p_konnr like EKKO-ebeln  MATCHCODE OBJECT MEKK ,
                      P_KTPNR like EKPO-ktpnr.
    SELECTION-SCREEN: END OF BLOCK s05.
    SELECTION-SCREEN: BEGIN OF BLOCK s02 WITH FRAME TITLE text-s02.
    parameters:       p_lifnr like ekko-lifnr modif id CTR,
                      p_EVERK like EKKO-VERKF," obligatory,
                      p_afnam type zafnam,
                      p_uwkenm like EKPO-TXZ01,
                      P_IHRAN like EKKO-IHRAN DEFAULT SY-DATUM,
                      P_KDATB like EKKO-KDATB," obligatory,
                      P_KDATE like EKKO-KDATE," obligatory,
                      p_cntVU LIKE RP50G-PERNR OBLIGATORY
                                  MATCHCODE OBJECT PREM,
                      p_advies type lifnr.
    SELECTION-SCREEN: END OF BLOCK s02.
    SELECTION-SCREEN: BEGIN OF BLOCK s03 WITH FRAME TITLE text-s03.
    SELECTION-SCREEN  PUSHBUTTON /1(17) WERK USER-COMMAND WERK.
    parameters:       P_TXZ01 like EKPO-TXZ01 obligatory,
    *                 p_txt9  type tline,
                      P_MATKL like EKPO-MATKL DEFAULT 'DNST-02' OBLIGATORY.
    selection-screen begin of line.
    SELECTION-SCREEN COMMENT 1(31) TEXT-001 FOR FIELD p_menge.
    parameters:       P_MENGE like EKPO-MENGE DEFAULT '1' OBLIGATORY,
                      P_MEINS like EKPO-MEINS DEFAULT 'ST' OBLIGATORY.
    selection-screen end of line.
    selection-screen begin of line.
    SELECTION-SCREEN COMMENT 1(31) TEXT-002 FOR FIELD p_netpr.
    parameters:       P_NETPR like EKPO-NETPR obligatory,
                      P_EPEIN like EKPO-BPRME DEFAULT 'ST' OBLIGATORY.
    SELECTION-SCREEN POSITION 55.
    parameters:       p_schpr like ekpo-schpr.
    selection-screen end of line.
    parameters:       p_saknr like mepoaccounting-sakto obligatory,
                      p_aufnr like mepoaccounting-aufnr obligatory.
    SELECTION-SCREEN: END OF BLOCK s03.
    initialization.
      clear h_exit.
      set pf-status 'STANDAARD'.
      move 'Werkomschrijving' to WERK.
    at selection-screen on p_contr.
    loop at screen.
    if p_contr = 'X'.
          if screen-group1 = 'CTR'.
            screen-input = 0.
            screen-active = 0.
            screen-required = 0.
            modify screen.
          else.
            screen-input = 0.
            screen-active = 1.
            screen-required = 1.
            modify screen.
          endif.
    endif.
    endloop.
    at selection-screen on exit-command.
      case sy-ucomm.
        when '&F03' or '&F015' or '&F12'.
          leave program.
      endcase.
    at selection-screen on block S01.
      case sy-ucomm.
        when 'ONLI'.
          type_doc = 'B'.
        when 'ONLI1'.
          type_doc = 'O'.
      endcase.
    perform checks_org.
    at selection-screen on block S02.
      perform checks_lev.
    at selection-screen on block s03.
      check sy-ucomm(4) eq 'ONLI'.
      perform checks_werk.
    at selection-screen.
      case sy-ucomm.
        when 'WERK'.
          perform lange_omschrijving.
        when 'SPOS'.
          CALL FUNCTION 'RS_VARIANT_SAVE_FROM_SELSCREEN'
            EXPORTING
              CURR_REPORT = 'ZBESTELLING'.
      endcase.
    start-of-selection.

Maybe you are looking for