user3894937
user3894937

Reputation: 73

Set value dynamic action not working in apex

I have a problem creating sql dynamic action in oracle apex v4.2. I have two fields, Department number and department name. Department number is a text field with autocomplete. The department name is a display field. On changing the department number, the department name should be displayed by an sql query.

I created a set value dynamic action on department number, giving the correct values in page item to submit and the correct sql query referencing P3_DEPARTMENT_NO.

When i run the page, after select a department number, the department name is not coming up automatically.

Could you please suggest on what i might be missing.

Thanks in advance.

Upvotes: 0

Views: 5569

Answers (2)

Bacs
Bacs

Reputation: 919

The exact behaviour of autocomplete lists is probably browser dependent, but generally speaking, don't rely on the "Change" event, as it won't necessarily fire when you select from the list.

You'll need to experiment to get the behaviour you want in your particular situation, but as a starting point you might want to try replacing the "Change" event type on your dynamic action with "Lose focus". That way the dynamic action should always be triggered when you tab or click away from P3_DEPARTMENT_NO.

In similar situations in the past, I've used "Key release" instead of "Lose focus", and I've created a second dynamic action which does the same thing, but triggered by "Get focus". That combination ensures that the display field stays synchronised with the user's selection, whether a value is keyed in or selected from the autocomplete list. Whether or not you go this route depends on how happy you are about the database being hit with your department name query every time a user interacts with P3_DEPARTMENT_NO in any way.

Upvotes: 0

Iulian
Iulian

Reputation: 169

You can try use this way:

  • First step: In the Shared Components -> Application Processes: create a process myProcess an put your sql dynamic in.
  • Second step: Create a javascript function myFunction to call the process myProcess.
  • Third step: Use onChange event to call your javascript function myFunction.

Also you can find a lot of exemples on Denes Kubicek app: https://apex.oracle.com/pls/otn/f?p=31517:101:116042570427567.

Best regards,

iulian

Upvotes: 0

Related Questions