« Step away from the table...moving from to
in your templates | Main | Well it had to happen.... »


On a recent project we ran across a great place to use apex_util.set_session_state and apex_util.json_from_items. A client wanted an email address to self populate after picking a name from a pop-up LOV. Easy enough but how to do this...options options options...well we could have used jQuery but I decided to use APEX_UTIL because of the existing code on the page. So here is what we did..

First, we added an onChange event to the HTML Form Element Attributes of the popup LOV:



Next on to the javascript in the header....

function getEmail(pUser) {
    var get = new htmldb_Get(null,$v('pFlowId'),
    gReturn = get.get();

nothing too complex...just calling an APEX onDemand process and passing over a user name. In return we get an email address as JSON.

Last is the onDemand plsql. We use apex_util.set_session_state and apex_util.json_from_items to set the item and pass over the email address.

  l_userid varchar2(100);
  l_email varchar2(100);
  l_userid := wwv_flow.g_x01;
   SELECT email
   into l_email
   FROM my_user_table
   WHERE upper(user_account) = upper(l_userid);



Now when a user selects from the pop-up LOV, the email address is auto filled into the approver email text field.

Nothing earth shattering here but rather helpful when you want to have values filled in on the page automatically giving that web 2.0 fresh feeling. Also on Chris Beck's blog is a bigger implementation of JSON calls to a apex shuttle.

PrintView Printer Friendly Version

EmailEmail Article to Friend

References (2)

References allow you to track sources for this article, as well as articles that were written in response to this article.

Reader Comments (1)

Very concise.

Just what I was attempting to do the other day, but just missing the json component.

All we need now is for the Oracle Apex Documentation to catch up.

March 3, 2010 | Unregistered CommenterScott Wesley

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>