How to Show/Hide a text field depending on Select List choice in Oracle Apex?

Stephen Walsh picture Stephen Walsh · Mar 11, 2013 · Viewed 10.4k times · Source

Simple question but I'm new to Apex...

Basically I have two items: a Select List and a Text Field. By default the text field should not appear. The Select List has two values for the user to choose from. If the user selects on of the values then the text field will stay hidden but if the user selects the other value then the text field will appear.

Example:

From the Select List the user can choose either "Show" or "Hide". If the user chooses "Hide" the text field should be hidden, as it should be by default. But if the user chooses "Show" then the text field will appear.

How can I do this?

TIA

Answer

Ro Milton picture Ro Milton · Mar 12, 2013

Try this:

  1. Bring up the select list item. Go to the List of Values section and ensure the following is set:

    • Display null value: No
    • List of Values Definition: STATIC:SHOW;SHOW,HIDE;HIDE [you can replace this with stored LOV if you wish]

  2. Create a new dynamic action with the following properties:

    Main Properties

    • Event: Change
    • Selection Type: Item(s)
    • Item: [P1_SELECT_LIST]
    • Condition: Equal to
    • Value: SHOW

      True Action

    • Action: Show

    • Fire when Result is: True
    • Fire on page load: Yes
    • Selection Type: Item(s)
    • Item: [P1_TEXT]

      False Action

    • Action: Hide

    • Fire when Result is: False
    • Fire on page load: Yes
    • Selection Type: Item(s)
    • Item: [P1_TEXT]