This discussion is archived
5 Replies Latest reply: May 17, 2013 7:42 AM by EricSacramento RSS

Automatic Select List or Display as text

EricSacramento Newbie
Currently Being Moderated
Hi Guys,

I am trying to to disable Application Column from my tabular form. If the data exists it should be blocked, but if the user clicks on the ADD button the select list should appear.

I tried with javascript is many ways ....

$('td[headers="APPLICATION"]').attr("disabled","disabled").addClass('apex_disabled');

document.getElementById('f05_000'+i).disabled=true;

$x('f05_000'+i).readOnly = "readonly";
......

But when I click on submit button I got constraint error because all the select list change to null value.

now I am trying to do this

select
ID,
CODE_U,
ACCES,
case
when
v('REQUEST') = 'ADD' THEN
APEX_ITEM.SELECT_LIST_FROM_LOV(5,APPLICATION,'LOV_LISTE_APPLICATION',NULL,'YES',NULL,'- Choisir')
ELSE
APEX_ITEM.TEXT_FROM_LOV(APPLICATION,'LOV_LISTE_APPLICATION')
END APPLICATION
from GESTION_DES_ACCES
WHERE CODE_U = :P2_CODE_U

But it's not working too. Can you give me some suggestions ?

I am using Apex 4.1.1


Thank you,
Eric
  • 1. Re: Automatic Select List or Display as text
    riedelme Expert
    Currently Being Moderated
    Eric Sacramento wrote:
    Hi Guys,

    I am trying to to disable Application Column from my tabular form. If the data exists it should be blocked, but if the user clicks on the ADD button the select list should appear.

    I tried with javascript is many ways ....

    $('td[headers="APPLICATION"]').attr("disabled","disabled").addClass('apex_disabled');

    document.getElementById('f05_000'+i).disabled=true;

    $x('f05_000'+i).readOnly = "readonly";
    ......

    But when I click on submit button I got constraint error because all the select list change to null value.

    now I am trying to do this

    select
    ID,
    CODE_U,
    ACCES,
    case
    when
    v('REQUEST') = 'ADD' THEN
    apex_item.select_list(5,APPLICATION,'LOV_LISTE_APPLICATION',NULL,'YES',NULL,'- Choisir')
    ELSE
    APEX_ITEM.TEXT_FROM_LOV(APPLICATION,'LOV_LISTE_APPLICATION')
    END APPLICATION
    from GESTION_DES_ACCES
    WHERE CODE_U = :P2_CODE_U

    But it's not working too. Can you give me some suggestions ?

    I am using Apex 4.1.1

    Thank you,
    Eric
    Did you try setting the disabled property as one of the form field attributes in APEX_ITEM.whatever?
  • 2. Re: Automatic Select List or Display as text
    EricSacramento Newbie
    Currently Being Moderated
    I went to Report Attributes -> APPLICATION column -> Column Attributes

    and I see 6 options:

    Display As
    Number / Date Format
    Field Template
    Element Attributes
    Element Option Attributes

    How can I switch to enable and disable for item here ?

    Thank you,
    Eric
  • 3. Re: Automatic Select List or Display as text
    riedelme Expert
    Currently Being Moderated
    I was thiniking to set the disabled property as part of one of your APEX_ITEM calls as part of the P_ATTRIBUTES parameter
  • 4. Re: Automatic Select List or Display as text
    vdsadhi Journeyer
    Currently Being Moderated
    After disabling the select list value, you cant get the value of the select list. In your case, you can hide the select list before that you should create a text item with selected value in the select list, try the below code in DA
    $('select[name="f05"]').each( function(i) {
         
         var rowSelected= $(this).attr("id").substr(4);
    
            var appSelect= $('#f05_'+rowSelected).attr("id");
         
              //To change the background color for Application column
    
               $x(appSelect).style.background = "#F2F2F5";
    
              //To get the value from "Application" select list and hide it
    
              var fake = $("<span>"+$("#f05_"+rowSelected+ " :selected").text()+"</span>");
              $("#f05_"+rowSelected).before(fake); 
              $("#f05_"+rowSelected).hide(); 
              
            }
    );
    Thanks,
    Lakshmi
  • 5. Re: Automatic Select List or Display as text
    EricSacramento Newbie
    Currently Being Moderated
    It worked thanks !! :D

    Thank you riedelme too !

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points