BWhite
BWhite

Reputation: 11

Pre Populate Text Fields in Apex

I'm trying to fill out various text fields on an apex application when I select a Reference Number in a select list.

When the page loads I'd like the text fields to be filled with the information from the database related to the reference number from the select list, however, I don't know how to do so. Any suggestions or help would be most appreciated!

Upvotes: 1

Views: 1246

Answers (1)

Littlefoot
Littlefoot

Reputation: 143163

As far as I understood the question:

  • user opens a page
  • there's a Select List item
  • user picks a value
  • you want to populate certain items on that page, based on a value user previously selected

If that's so, you'd use a dynamic action - create it on the Select List item, pick set value type.

[EDIT: How to do that?]

Scott's schema, DEPT table. Suppose that the select list item is P15_DEPTNO, while two other items are P15_LOC and P15_DNAME.

  • create a dynamic action on P15_DEPTNO
    • event: change
    • item: P15_DEPTNO
  • create its True action:

    • action: set value
    • type: SQL statement

      select loc, dname
      from dept
      where deptno = :P15_DEPTNO
      
    • items to submit: P15_DEPTNO

    • affected elements: items P15_LOC, P15_DNAME

That's all.

Upvotes: 1

Related Questions