2

I have a select list component in Oracle apex and one button

Select list drop down as below values I can choose any one

-

  • A
  • B
  • C

On button click I have written a java script

if $('#P1_DROPDOWN').val() == 'A'
{
   alert.message('A value is selected') 
}
else
{
   apex.item.setvalue(index[0])  -- blank 
   or 
   reset the list to none selected 
} 

How do I reset the List item to none o original state

kiric8494
  • 195
  • 1
  • 7

1 Answers1

1

Here is an example for a select list that has "Display Null Value" set to "Yes" and no value for "Null Return Value".

if (apex.item( "P1_DROPDOWN" ).getValue() == 'A') {
    alert('a was clicked');
} else {
    apex.item( "P1_DROPDOWN" ).setValue( "" );
}

If there is a return value for the Null value, then change the setValue accordingly.

Side Note: Instead of clearing the selected value a validation indicating why the selected value is not the correct one might give a better user experience.

Koen Lostrie
  • 14,938
  • 2
  • 13
  • 19