Step by step to try AJAX Select LIST

Hi Pakars
Please describe step by step,
how to create Ajax Select list ?
Refer in this
http://apex.oracle.com/pls/otn/f?p=11933:37:8080121466477345
Thanks

Hi,
I use these instructions to create an AJAX lov, hope they help
1 - Under shared components create an item called TEMPORARY_ITEM
2 - Under shared components create an application process
declare
l_counter number;
l_o_name varchar2(2000);
begin
owa_util.mime_header('text/xml', FALSE );
htp.p('Cache-Control: no-cache');
htp.p('Pragma: no-cache');
owa_util.http_header_close;
htp.prn('<select>');
for rec in (select VALUE_HEADER_ID as "VALUE_HEADER_ID",
LOV_VALUE as "LOV_VALUE",
LOV_VALUE_ID as "LOV_VALUE_ID"
from TST_LOV_VALUES Where VALUE_HEADER_ID = :TEMPORARY_ITEM )
loop
htp.prn('<option value="' || rec.LOV_VALUE_ID || '">' || rec.LOV_VALUE || '</option>');
end loop;
htp.prn('</select>');
end;
Change the select in bold to match the sub LOV
3 - Add the following javascript to the html header of the page
<script language="JavaScript" type="text/javascript">
<!--
htmldb_delete_message='"DELETE_CONFIRM_MSG"';
function get_AJAX_SELECT_XML(pThis,pSelect,pName,pNullDefault){
var l_Return = null;
var l_Select = html_GetElement(pSelect);
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,pName,0);
get.add('TEMPORARY_ITEM',pThis.value);
gReturn = get.get('XML');
if(gReturn && l_Select){
var l_Count = gReturn.getElementsByTagName("option").length;
l_Select.length = 0;
if ( pNullDefault == true )
appendToSelect(l_Select,'','') ;
for(var i=0;i<l_Count;i++){
var l_Opt_Xml = gReturn.getElementsByTagName("option");
appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
get = null;
function appendToSelect(pSelect, pValue, pContent) {
var l_Opt = document.createElement("option");
l_Opt.value = pValue;
if(document.all){/* why is ie different ask bill */
pSelect.options.add(l_Opt);
l_Opt.innerText = pContent;
}else{
l_Opt.appendChild(document.createTextNode(pContent));
pSelect.appendChild(l_Opt);
//-->
</script>
4 - Create the first LOV abd in the HTML Form Element Attributes add the following text
onblur="get_AJAX_SELECT_XML(this,'P2_CHILD','APPLICATION_PROCESS=CHILD_Select_XML',false)"'
5 - Create the sub lov
Ensure the List of values definition relates to the main lov in the where clause e.g.
select LOV_VALUE d, LOV_VALUE_ID r
from TST_LOV_VALUES
where VALUE_HEADER_ID = :P2_HEADER

Similar Messages

  • How to set "Display as Text" field with AJAX select list

    thanks Denes for your posting. I'm trying to use the Denes Kubicek code to populate a "Display as Text" field. It works for Text Field (disabled), but not "Display as Text" field(saves state) . In my applciation I need to show this field only (not the disabled text box) when a select list value is changed. any ideas to modify the code below are appreciated.
    http://htmldb.oracle.com/pls/otn/f?p=31517:80:3418128396960418::NO
    here is the code from the url above
    1. Create an Application Process - getDet:
    DECLARE
    my_det VARCHAR2 (200);
    BEGIN
    SELECT ename || CHR(10) || job || CHR(10) || mgr
    INTO my_det
    FROM emp
    WHERE empno = :P80_EMPLOYEES;
    HTP.prn (my_det);
    END;
    2. Put the following in the Region Header of your page:
    <script language="JavaScript" type="text/javascript">
    function f_getDet ()
    var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=getDet',0);
    get.add('P80_EMPLOYEES',html_GetElement('P80_EMPLOYEES').value)
    gReturn = get.get();
    if(gReturn)
    {  html_GetElement('P80_DETAILS').value = gReturn  }
    else
    {  html_GetElement('P80_DETAILS').value = 'null'  }
    get = null;
    </script>
    3. Put the following in the HTML Form Element Attributes of :P80_EMPLOYEES:
    onChange="f_getDet()";

    Arie,
    this works fine on normal page, except page zero. I have the AJAX select list and "Display as Text" field on page zero. The "Display as Text" field doesn't show the the value when AJAX select is changed. I'm using similar code as used in my other APEX page on OTN site. I tired to display the gReturn value, just before calling "setDisplayOnlyNode" function in the code below and it's showing correct value, but fails to display the value in the APEX field on page zero. Any ideas are appreciated.
    Thanks,
    Surya
    <script language="JavaScript" type="text/javascript">
    function setDisplayOnlyNode(pItem, pValue)
    { var textNode = pItem + '_DISPLAY'; $x(textNode).innerText = pValue; }
    function f_getDet ()
    var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=getDet',0);
    get.add('P1_EMPLOYEES',html_GetElement('P1_EMPLOYEES').value)
    gReturn = get.get();
    if(gReturn)
    { setDisplayOnlyNode('P1_DETAILS',gReturn)}
    {  html_GetElement('P1_TEST').value = gReturn  }
    get = null;
    </script>

  • AJAX Select list implementation

    Hi,
    I'm trying to implement the AJAX Code Generator from Scott ( http://htmldb.oracle.com/pls/otn/f?p=33867:2 ) using dept no select list and dept name text field. When I change the Dept# selection from the options, all I get is a huge chunk of html code in my dept name text field and it doesn't contain the result.
    Can any one help me out with what i'm doing wrong?
    Thanks.
    - Richard

    Carl,
    Thanks for helping me out.
    Important thing I missed to mention in my original post.... I'm using HTMLDB ver 1.6 copied the js files needed, from htmldb.oracle.com
    Here is the url for the page I created in htmldb.oracle.com. But, when I recreated it, the onchange gets me "null" in department name field instead of huge chunk of HTML code.
    http://htmldb.oracle.com/pls/otn/f?p=19793:24:

  • Slight AJAX select list issue, hopefully....

    I have probably looked at every example that uses AJAX to populate select lists that is out there and finally got one almost completely working.
    In my app I use a Form on page 23 to create a record and then also use a form on page 22 to update a record. On both of these pages i have 2 select lists that use AJAX to populate each other. On my Create Form page, these two select lists display properly and submit properly to a report page.
    Now, when i click on that record that i just created from the report page, i am taken to the update page(page 22) where all items that i just submitted are properly displayed except the second select list. The second select list does display the correct list of items within the select list, just not the one that i had just selected. What is being displayed is the very first option in the select list, no matter what i had selected when i created the record. What in my code would always make the first option display no matter what?
    Thanks
    Deanna
    For example:
    My current ouput:
    Pg.23(Creating the record)
    Parameters:
    :P23_CASE_NUMBER--------------------------9999999999
    :P23_CONT_FACTOR_CATEG--------------Driver Distracted By
    :P23_CAUSES-----------------------------------Other Electronic Devices
    Pg.22(Updating the record)
    Parameters:
    :P22_CASE_NUMBER--------------------------9999999999
    :P22_CONT_FACTOR_CATEG--------------Driver Distracted By
    :P22_CAUSES-----------------------------------Mobile(cell)phone(WRONG)(First option in list)
    Output I should see:
    Pg.23(Creating the record)
    Parameters:
    :P23_CASE_NUMBER--------------------------9999999999
    :P23_CONT_FACTOR_CATEG--------------Driver Distracted By
    :P23_CAUSES-----------------------------------Other Electronic Devices
    Pg.22(Updating the record)
    Parameters:
    :P22_CASE_NUMBER--------------------------9999999999
    :P22_CONT_FACTOR_CATEG--------------Driver Distracted By
    :P22_CAUSES-----------------------------------Other Electronic Devices(CORRECT)
    Current code from page 22(Update Page):
    This is from the Header HTML
    <script language="JavaScript1.1" type="text/javascript">
    function get_TASK_SELECT_XML(pThis,pSelect){
    var l_Return = null;
    var l_Select = $x(pSelect);
    var get = new htmldb_Get(null,$x('pFlowId').value,
    'APPLICATION_PROCESS=TaskXML',0);
    get.add('WORK',pThis.value);
    gReturn = get.get();
    gReturn = get.get('XML');
    if(gReturn && l_Select){
    var l_Count = gReturn.getElementsByTagName("option").length;
    l_Select.length = 0;
    for(var i=0;i<l_Count;i++){
    var l_Opt_Xml = gReturn.getElementsByTagName("option");
    appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'),
    l_Opt_Xml.firstChild.nodeValue)
    get = null;
    function appendToSelect(pSelect, pValue, pContent) {
    var l_Opt = document.createElement("option");
    l_Opt.value = pValue;
    if(document.all){
    pSelect.options.add(l_Opt);
    l_Opt.innerText = pContent;
    }else{
    l_Opt.appendChild(document.createTextNode(pContent));
    pSelect.appendChild(l_Opt);
    </script>
    This is the application process - TaskXML
    begin
    owa_util.mime_header('text/xml', FALSE );
    htp.p('Cache-Control: no-cache');
    htp.p('Pragma: no-cache');
    owa_util.http_header_close;
    htp.prn('<select>');
    htp.prn('<option value="' || -1 || '">' || ' - Select-' || '</option>');
    for rec in (select cause , cause
    from cause where categ = :WORK)
    loop
    htp.prn('<option value="' || rec.cause_number || '">' || rec.cause || '</option>');
    end loop;
    htp.prn('</select>');
    end;

    Hello Deanna,
    Is the "select cause, cause" statement a typo?
    for rec in (select cause , cause
                  from cause where categ = :WORK)
    loop
       htp.prn('<option value="' || rec.cause_number || '">' || rec.cause || '</option>');
    end loop;
    htp.prn('</select>');
    end;If not, the list you're seeing could possibly be the result of the LOV defined for P22_CAUSES, assuming there is one.
    - Alwyn

  • AJAX Select Lists on Updateable Reports

    All,
    I have followed the examples from Karl and Sergio's blog on how to use AJAX to contol dependent LOV lists in a form. My question is, can this be done in an updateable report? I'm having difficulty in determining how to reference the column names of the dependant lists.
    What I basically have is a time app. User selects his project from a picklist and then his associated tasks for that project will appear in the task list. I have used the updatable report option to build this rather then a form, because I liked the prebuilt add row and processing functionality.
    Anyway if anyone knows how to use AJAX dependant select lists in an updateable report it would be greatly appreciated.
    Thanks
    Rob

    See http://forums.oracle.com/forums/thread.jspa?messageID=1222153&#1222153

  • Ajax select list with an updateable report

    Hi,
    I have an updateable report where the first 3 columns are all select lists and where the values in each of the select lists are dependent on the value selected in the previous select list.
    I've been able to implement this for the first 2 columns using ajax ie. the values in the select list for the second column are based on what value has been selected in the first column, but I have not been able to apply the same logic to the list of values for the 3rd column, which should be based on what has been selected in the second column.
    Also, when the value of the first column is changed, it should be blanking out the values of the 3rd column, until the new second column value has been selected, based on the change to the value of the first column.
    Any assistance/advice would be much appreciated.
    Many Thanks,
    Marquita

    How did you do that for the fisrt 2 columns, I could only do it in a form not in a report, appreciate your help

  • SELECT LIST about...

    Hello.
    Is there any way to create multiple 'select list's. That each one depending on each other? There are three 'select list' in my case.
    First - city
    Second - department
    Third - Person
    Of course, if I change 'city' one I want other two to change automatically BUT - without reloading page! Is it possible? There are department with very low connection rate - often reloading page - is very expensive for them..

    Why there is no answer? Are my question silly?Well...there are a few reasons for that -
    1) It's the weekend
    2) You have waited less than an hour for a reply.
    3) Nobody is 'paid' to provide support on these forums, we all do it for free in our (limited) spare time (see point 1)
    Yes what you have asked is achievable, take a look at the following blog posting by Scott Spendolini which you should be able to use and adapt
    http://spendolini.blogspot.com/2005/10/ajax-select-list-code-generator.html

  • TS1398 In "Set Up" I try to select our secured WIFi router from the list of available networks.  However, it will not allow me to select it. This then prevents me from going to the next step. What do I do?

    In "Set Up" I have tried to select our secured WiFi router from the available list shown.  It is listed.  However, when I try to select it, it will not check off or remain blue when I lift my touch.  This then will not allow me to go on to the next step.  What do I do to connect to a secure WiFi router? I do know the WEP Key number but there is no place to type then in.
    Alice from Hart

    The trial can only be loaded 1 time as far as I know. You could try http://labs.adobe.com/downloads/acrobatcleaner.html, remove any left over parts of the Acrobat folder, and reboot. Then try an install again, but my guess is you will have to purchase Acrobat at this point.

  • AJAX dependent Select lists

    Can anyone please help me figure out where am going wrong?
    I have 2 regions on page 1. Region 1 is supposed to have 2 drop down lists (cascading i.e values in second drop down Drop List HJ are dependent on value selected in first lov Ajax Select HJ). Region 2 will be a report.
    I am trying to create AJAX cascading lovs based on eg. provided on carl's application so that Region 2 is not refreshed each time I select a value from the drop down's
    [http://apex.oracle.com/pls/apex/f?p=36391:37:1510004986327720::NO:RP::]
    I have downloaded the application and tried to do the exact same steps, but my child lov is not updating its values after I select a value from in Ajax Select HJ.
    My application is available at http://apex.oracle.com/pls/apex/f?p=33829:1:2010637670427735:::::
    Appreciate any help on this
    Thank you
    Deepu

    Thank you Denes !! The example really helped me. Now I am stuck at the next level. I am new to apex and learning and building dashboard for my organization. So, please bear with me.
    I have a page that is divided into 4 regions. Each region displays a chart that is generated dynamically. When I say dynamic, each region has 2 drop down lists.
    First pull down has Org and Year as values, if they wish to view chart by Org or Year. If they choose Org, second drop down defaults to Org. If they choose Year, second drop down displays Year's as 2010, 2009,2008 so on. Depending on which year they choose they should be able to view that Year's chart by month in that region.
    Initially I had used select lists with submit for drop down's but that was refreshing the whole page. But now after using your example with AJAX I was able to accomplish the cascading Lov's stuff. Now, after user selects a value in second drop down, is there a way that I can display the chart and refresh only that region each time user selects a value from the drop down.
    I want to avoid refreshing the page each time, I need each region to refresh based on user selection in drop down's. Is this possible in apex? Is there any example that you could direct me to.
    Thank you so much for all your inputs. Appreciate it very much
    Deepu

  • APEX Ajax Cascading Select List Tabular

    Hi everyone,
    We’re developping in APEX 4.X.
    I went to your blog « Denes Kubicek - ApEx Solutions », it’s very interesting
    http://apex.oracle.com/pls/otn/f?p=31517:176:384744492803038:::::
    I tried to create something as Mr Kubicek did to get an Ajax Cascading Select List Tabular.
    In step 5, he says the rest of the code if you apply for an account". Do we need to add a lot of code to get success ?
    Is there someone who tries to do like Mr Kubicek did ?
    Thanks in advance. Bye.
    Eric.

    Hi everyone,
    I looked at Mr Kubicek solutions about tabular form and I asked him to get access to his workspace. But I’m not sure to get all I need.
    I have a two select list named Activities and Entity. I want that Entity depends on Activities. Those list values come from respectively table h4_activities and h4_activity_entity.
    But, when I show the tabular form, I want to see records which is in table h4_activity_day. I don’t want to see only my two select lists.
    I think tabular form should be interesting.I want your advice.
    But, I need something like a select list with a LOV and SOURCE.
    Thanks in advance.
    Have a great day. Bye
    Eric

  • AJAX Dynamic Select List

    Hello Ladies and Gentlemen,
    I have a Select List, :P9_ELEMSTRUCTSAISIEPARCBO, based on a hidden item, :P9_NOSAISIEPAR, and this is the query it's based upon:
    select Description, ElemStructID
    from V_ElemStruct, V_Dispensateur
    where DispensateurID = DispensateurIDResponsable
    and NumeroDispensateur = :P9_NOSAISIEPAR
    order by DescriptionI also have a popup page that shows a report with a column link that passes back values to the original page, and one of those values replace :P9_NOSAISIEPAR's current value. I want to reload the Select List via AJAX, so that the changes can be in real-time. I found Carl Backstrom's (He was a wonderful man) tutorial on his application (http://apex.oracle.com/pls/otn/f?p=11933:37) and decided to try it. But it just won't work, and I have no idea why.
    I know the popup works just fine, and I tested the On Demand Application Process in the SQL Commands of the SQL Workshop and it seems to be working just as fine. Thus, I've narrowed it down to the thought that the JavaScript must be the problem, logically.
    Here is the code for the "HTML Form Element Attributes" of the :P9_NOSAISIEPAR hidden item:
    onChange="f_PopulateField(this,'P9_ELEMSTRUCTSAISIEPARCBO')"Here's my on Demand Application Process:
    begin
      owa_util.mime_header('text/xml', FALSE);
      htp.p('Cache-Control: no-cache');
      htp.p('Pragma: no-cache');
      owa_util.http_header_close;
      htp.prn('<select>');
      for rec in
      (select
         Description as Description,
         ElemStructID as ElemStructID
       from
         V_ElemStruct,
         V_Dispensateur
       where
         DispensateurID = DispensateurIDResponsable
         and NumeroDispensateur = :F102_TEMP_APP_ITEM
       order by
         Description
      ) loop
      htp.prn('<option value="' || rec.ElemStructID || '">' || rec.Description || '</option>');
      end loop;
      htp.prn('</select>');
    end;and here's my JavaScript:
    function f_PopulateField(pThis,pSelect)
      var l_Select = $x(pSelect);
      var l_Return = null;
      var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=PopulateField',0);
      get.add('F102_TEMP_APP_ITEM',pThis.value)
      gReturn = get.get('XML');
      if(gReturn && l_Select)
        var l_Count = gReturn.getElementsByTagName("option").length;
        l_Select.length = 0;
        for(var i=0;i<l_Count;i++)
          var l_Opt_Xml = gReturn.getElementsByTagName("option");
    appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'),l_Opt_Xml.firstChild.nodeValue)
    get = null;
    function appendToSelect(pSelect,pValue,pContent)
    var l_Opt = document.createElement("option");
    l_Opt.value = pValue;
    if(document.all)
    pSelect.options.add(l_Opt);
    l_Opt.innerText = pContent;
    else
    l_Opt.appendChild(document.createTextNode(pContent));
    pSelect.appendChild(l_Opt);
    I have installed FireFox and FireBug, and I tried to debug my JavaScript, and that made me realize something. In the FireBug's HTML tab, :P9_NOSAISIEPAR doesn't have any onChange events mapped to it (and all my other items which should have an event mapped to them do have one).
    <input type="hidden" id="P9_NOSAISIEPAR" value="2222" name="p_t63">compared to:
    <select onchange="$f_Show_On_Value_Item('P9_SECURITAIRE','P9_NOTEACCOMPAGNATEUR',1)" id="P9_SECURITAIRE" size="1" name="p_t23">So, my best bet is that the JavaScript doesn't even get executed by the page at all (it's not appearing in FireBug's JavaScript tab at all either). Any idea why?
    Best regards,
    Mathieu

    I finally found a way to do it. When selecting my value in my popup page, I show my hidden field, change the value, manually call the onChange event, hide back my hidden field, and then close the popup. That way the onChange event fires in IE. Afterwards, as a workaround to the XML not being recognized by IE, I changed
    get.get('XML')for
    get.get()to get a string instead of some XML, and I parsed it to XML DOM using a manual parser (because IE is too weak to have its own). Here is the code for the DOMParser.
    if (typeof DOMParser == "undefined")
        DOMParser = function () {}
        DOMParser.prototype.parseFromString = function (str, contentType)
          if (typeof ActiveXObject != "undefined")
            var d = new ActiveXObject("MSXML.DomDocument");
            d.loadXML(str);
            return d;
          else if (typeof XMLHttpRequest != "undefined")
            var req = new XMLHttpRequest;
            req.open("GET", "data:" + (contentType || "application/xml") +
                             ";charset=utf-8," + encodeURIComponent(str), false);
            if (req.overrideMimeType)
              req.overrideMimeType(contentType);
            req.send(null);
            return req.responseXML;
      }It wasn't written by me, I found it on Erik's Weblog (http://erik.eae.net/archives/2005/07/03/20.19.18/), so all credit goes to him.
    Best regards,
    Mathieu

  • I installed the latest iTunes update. Now iTunes won't recognize my iPod. I tried every step in the trouble-shooting list and nothing works. Apple wants to charge me $35 just to ask them a question. What should i do?

    I have tried every step in the trouble-shooting list, and nothing helps. What should I do?

    I am having this same issue.  I have avoided updating it for months and now that I finally did this is what happens!!  My Ipod goes into charge mode, but then as soon as iTunes opens up to sync it says it knows there is an ipod connected but does not recognize it and it will stop charging and just go to the main screen that comes up when you turn ipod on.  I even tried Uninstalling and reinstalling like it says and that doesn't work.  When I uninstall it, it will let my ipod charge when I connect it to computer.  But as soon as I install iTunes again and try to connect it, it tells me the same thing.  Now I know why I never update to newer versions, so angry right now.  Apple needs to fix this problem cause I've had my ipod for less than a year!!

  • I am having a problem when I try to select a photo or itunes song in Imovie or other programs. I get a window with grey lettering that says: "Open Itunes to populate this list" or "Open iphoto to see photos from your iPhoto library in this list.  I have t

    I am having a problem when I try to select a photo or itunes song in Imovie or other programs. I get a window with grey lettering that says: "Open Itunes to populate this list" or "Open iphoto to see photos from your iPhoto library in this list.  I have tried relaunching programs and nothing appears. Seemed to start happening a while back after one of my system upgrades.

    After a a lengthy conversation with Apple Tech. ($20), my problem seems to be solves. The Iphoto problem solved by trashing the plist file. The Itunes was more involved. We had to create a new Itunes folder and import the files into the new folder; and then import the playlists.

  • Storing SELECT list definition after AJAX call

    Hi all
    I redefine the options in the SELECT item via AJAX call. The application process returns string similar to <option>x1</option><option>x2</option>, which is set as SELECT item innerHTML content. Everything works fine.
    The problem is that I need to switch to another page and than return back. The original page is re-rendered and the redefinition of the SELECT item options is obviously lost.
    Any recommentation how to solve it simply and robustly?
    Thanks
    Roman

    I think i should do a Modal window, like described there:
    http://oracleapexbynandinithakur.blogspot.com/2011/02/modal-form-in-apex.html
    And after inserting a new record in Modal window user closes the Modal window with a button there, and i somehow then repopulate the underlying page's Select List component.

  • Apex 4.0 Cascading Select List: ajax problem with german umlaute

    Hi everybody,
    Apex 4.0
    Dad PlsqlNLSLanguage: GERMAN_GERMANY.WE8MSWIN1252
    I have problems with german umlaute and ajax cascading select lists (Cascading LOV Parent Item).
    The data is populated without a page refresh in the select list when the parent select list changes but special signs like german umlaute are shown as weird characters.
    Seems like there is some charset problem with ajax.
    This is the only part of the application where special signs like umlaute are messed up. Everything else is fine.
    I allready tried to figure out if I can escape the umlaute in the javascript (file apex_widget_4_0.js) but no success here.
    Can anybody help me with this issue?
    Thanks in advance,
    Markus

    Hi Markus,
    your specified character set in your DAD is wrong. As mentioned in the installation instructions at http://download.oracle.com/docs/cd/E17556_01/doc/install.40/e15513/otn_install.htm#CHDHCBGI , Oracle APEX always requires AL32UTF8.
    >
    3. Locate the line containing PlsqlNLSLanguage.
    The PlsqlNLSLanguage setting determines the language setting of the DAD. The character set portion of the PlsqlNLSLanguage value must be set to AL32UTF8,
    regardless of whether or not the database character set is AL32UTF8. For example:Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

Maybe you are looking for