This discussion is archived
9 Replies Latest reply: Jan 26, 2013 8:44 AM by Howard (... in Training) RSS

Oracle Apex conditional field display

987022 Newbie
Currently Being Moderated
Hi,

I have created two page wizard in Oracle Apex.

I have item and item_detail table. For item1, I have one detail record and for item2, I have two detail record.

On Step 1: Choose item which will be drop down from item table.

On Step 2: Based on item detail record count, I want to display text fields on step 2. If item1 is selected in step 1 thenl display, textdisplay1 and textfield1 in step2. If item2 is selected step ` will display textdisplay1, textfield1, textdisplay2, textfield2 in step2.

sql/pl/sql condition will be: select count(*) from item_detail where item_id in (select item_id from item where item_name='one provided in step 1'

I want this dynamic ability to display fields or atleast to hide textdisplay2,textfield2 based on sql/plsql condition.

Thanks,
  • 1. Re: Oracle Apex conditional field display
    Mahmoud_Rabie Journeyer
    Currently Being Moderated
    Dear 984019,

    Please, check
    http://stackoverflow.com/questions/11763093/get-selected-item-of-an-select-list

    If this solve your problem, please mark it as Correct. Otherwise, as helpful

    Regards
    Mahmoud
  • 2. Re: Oracle Apex conditional field display
    987022 Newbie
    Currently Being Moderated
    Hello Mahmoud,

    Link that you provided talks more about dynamic LOV. I'm looking for solution that will hide/not display text fields based on input.

    Thanks

    Edited by: 984019 on Jan 24, 2013 4:11 PM
  • 3. Re: Oracle Apex conditional field display
    xarg-Xrc Explorer
    Currently Being Moderated
    You can either use Dynamic action and control the show/hide from there. Or use Javascript functions $x_show() $x_hide() to do the same (hardcoded though) job.
  • 4. Re: Oracle Apex conditional field display
    Howard (... in Training) Pro
    Currently Being Moderated
    984019,

    How are you coming with this?

    Since I'm a newbie, here's how I'd try to approach this.
    1) So we have the Selection List, say, :P1_SList
    2) Then I'd create a Dynamic Action (DA) triggered on a change to :P1_SList.
    3) The DA would have a PL/SQL procedure in the DA that computed (:P1_Disaplay_Number) 1 for text1, 2 for text2, ...
    4) Then I'd have a display Condition -- a PL/SQL Function Body Returning a Boolean -- on each item (text1, text2, ...), something like, say for text3, ...
    BEGIN
              IF :P1_Display_Number <= 3 THEN
                   RETURN TRUE;
               ELSE 
                   RETURN FALSE;
                END IF;
    END;
    And so forth -- I hope my syntax is correct! So the item Condition determines whether the item displays.
    5) You could set :P1_Display_Number to 0 initially, so no items display until the selection is made and the DA triggered.
    (I hope you don't have more than 10-15 of these text1 ... text15.)

    Is what I have described what you are trying to achieve?

    Best regards,
    Howard
  • 5. Re: Oracle Apex conditional field display
    987022 Newbie
    Currently Being Moderated
    Hello Howard,

    :P1_Display_Number is a text box so condition will be:


    DECLARE
    cnt number;
    BEGIN
    select count(1) into cnt from obe.v_schedule_parameter where id = (select id from obe.v_schedule_program where program_name=:P2_X);
    IF cnt = 1 THEN
    -- disable :P2_textbox
    END IF;
    IF cnt = 2 THEN
    null;
    END IF;
    END;

    Searching for pl/sql syntax to disable :P2_textbox.

    Thanks
  • 6. Re: Oracle Apex conditional field display
    Howard (... in Training) Pro
    Currently Being Moderated
    Fields / items display (or are hidden) by the result of the "Condition" selection on the APEX page specification for that field / item. (You have all those tabs at the top: Identification, User Interface, Grid Layout, Label, ..., Condition, ...) Condition determines if the field is displayed. It defaults to "- Item Not Conditional" but if you click the drop down, there are 30-50 different conditions. Exists, NOT Exists, ..., Never, Always. If you select "PL/SQL Function Body Returning a Boolean," it will add an Expression 1 box to the GUI where you can write a "Begin ... End;" block to return TRUE or FALSE for the condition. It display if TRUE is returned, hides if FALSE is returned. (Someone else chime in here if I've left something out.)


    This is a VERY slick feature of APEX. The only addiitons I could ask for would be: Positive, Negative and "Do what I mean".

    Howard
  • 7. Re: Oracle Apex conditional field display
    987022 Newbie
    Currently Being Moderated
    Thanks Howard.
  • 8. Re: Oracle Apex conditional field display
    987273 Newbie
    Currently Being Moderated
    Hello Howard,

    good day! this is an OT message.

    But i would like to ask if who among you who can deliver or conduct an Oracle Application Express Training.
    Since we are looking an outsource / Part time Trainer.

    If you can deliver or conduct this kind of training,please let know.
    Or if you have someone in your mind which can deliver on this,we would appreciate if you will refer it to us.

    You can reach through this email address: idoquila@gmail.com
    Mobile number's : +639 092438249. or +639 351908994.

    We appreciate your response on this.

    Thanks,
    IVy
  • 9. Re: Oracle Apex conditional field display
    Howard (... in Training) Pro
    Currently Being Moderated
    984270,

    Training? It certainly wouldn't be me. This might not be the appropriate forum for this. But perhaps someone will reply and direct us to the appropriate venue.

    I see you have already started your own thread for this. Good idea. But when you include your personal info in the forum, you expose yourself to SPAM, etc. So, I hope that doesn't happen to you.

    Best wishes,
    Howard

Legend

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