AJAX checkbox

I have a multi (7) column checkbox with form element attributes on my page:
onClick="refresh_reports_lov(this.value,this,$x('P507_SCHOOL'),$x('P507_YEAR'),'REFRESH_SIS_REPORTS_FILTER_LOV');toggle_items2(this.value,this)"
I am using Application process below to refresh the values, but when it fires it lists everything in 1 column and does not put in the 'On-Click'. How can you specify these things in the 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 ('<checkbox>');
FOR i IN (SELECT empno, ename
FROM emp
WHERE deptno = :selectlist_item_1
ORDER BY ename)
LOOP
HTP.prn ('<message>' || i.ename || '</message>');
HTP.prn ('<value>' || i.empno || '</value>');
END LOOP;
HTP.prn ('</checkbox>');
END;

I am using checkboxes in a report
SQL Query in Reports Region with checkboxes:
SELECT
APEX_ITEM.CHECKBOX(1,VALUE_FROM_TABLE,'checked="checked" onclick="javascript:f_ajaxAction(this);"')
FROM DUAL;
JavaScript Function in Regions Header that handles the Ajax Request and processes the Application Process:
<script type="text/javascript">
function f_ajaxAction( cb ){
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,'APPLICATION_PROCESS=AjaxApplicationProcess',0);
get.addParam('x01',cb.value); /*Parameter from Checkbox Value*/
gReturn = get.get();
get = null;
</script>
Application Process definition: AjaxApplicationProcess
declare
l_value varchar2(4000)
begin
-- checkbox value
l_value := wwv_flow.g_x01;
-- Do what you want with the value
END;
Maybe this helps you to use checkboxes with Ajax.
Philipp

Similar Messages

  • Setting Checkbox & Radio session state (AJAX)

    These functions will set the session state of a checkbox and radio items using Ajax.
    Any feedback is welcomed!
    // AJAX Checkbox Session
    function setCheckboxSession('P1_CHECKBOX'){
         var get = new htmldb_Get(null,html_GetElement('pFlowId').value,null,0);
         get.add(pSource,html_CheckboxValue('P1_CHECKBOX'));
         gReturn = get.get('XML');
         get = null;     
    function html_CheckboxValue(pItemId){
         var boxes=html_GetCheckbox(pItemId);
         var l_val='';
         for (var j=0;j<boxes.length;j++){
              if (boxes[j].checked){
                   l_val = boxes[j].value;
                   break;
         for (var i=j+1;i<boxes.length;i++){
              if (boxes.checked){
                   l_val = l_val+':'+boxes[i].value;
         return l_val;
    function html_GetCheckbox(pItemId){
    var l_array=new Array();
    var re=new RegExp('^'+pItemId.toUpperCase()+"_[0-9]+$");
    var inputs=document.getElementsByTagName('input');
    for (var j=0,l=inputs.length;j<l;j++)
    if (inputs[j].type=="checkbox" && inputs[j].id && inputs[j].id.match(re))
    l_array[l_array.length]=inputs[j];
    return l_array;
    // AJAX Radio Session
    function setRadioSession('P1_RADIO'){
         var get = new htmldb_Get(null,html_GetElement('pFlowId').value,null,0);
         get.add(pSource,html_RadioValue('P1_RADIO'));
         gReturn = get.get('XML');
         get = null;

    check this
    Re: Modifying session state with javascript

  • Shuttle and AJaX

    Hello all,
    I have an interesting issue to do with population of a shuttle in 3.1 using AJaX. The session state of selected items is what's causing me dramas, details as follows:
    The left side of the shuttle is populated according to a series of cascading select lists with an optional 'filter' checkbox on each. So every time the value of a select is changed or a checkbox checked/unchecked the ajax process is fired to repopulate the list accordingly.
    My Javascript is:
    function get_ITEMS(){
    var l_Count = 0
    var l_Return = null;
    var l_Select = $x('P2_ITEMS_LEFT');
    var get = new htmldb_Get(null,$v('pFlowId'),
    'APPLICATION_PROCESS=BUILD_ITEMS_SEL',0);
    get.addParam('x01',$v('P2_PRODFILTER'));
    get.addParam('x02',$v('P2_WORKFILTER'));
    get.addParam('x03',$v('P2_COREFILTER'));
    get.addParam('x04',$v('P2_PRODUCT'));
    get.addParam('x05',$v('P2_WORK_TYPE'));
    get.addParam('x06',$v('P2_CORESYSTEM'));
    get.addParam('x07',$v('P2_DISCIPLINE'));
    gReturn = get.get('XML');
    if(gReturn && l_Select){
    l_Count = gReturn.getElementsByTagName("option").length;
    l_Select.length = 0;
    for(var k=0;k<l_Count;k++){
    var l_Opt_Xml = gReturn.getElementsByTagName("option")[k];
    appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'),
    l_Opt_Xml.firstChild.nodeValue)
    get = null;
    and the application level process BUILD_ITEMS_SEL is:
    DECLARE
    v_doprod varchar2(3);
    v_dowork varchar2(3);
    v_docore varchar2(3);
    v_prod varchar2(30);
    v_work varchar2(30);
    v_core varchar2(30);
    v_disc varchar2(30);
    BEGIN
    v_doprod := wwv_flow.g_x01;
    v_dowork := wwv_flow.g_x02;
    v_docore := wwv_flow.g_x03;
    v_prod := wwv_flow.g_x04;
    v_work := wwv_flow.g_x05;
    v_core := wwv_flow.g_x06;
    v_disc := wwv_flow.g_x07;
    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 distinct(item) as "ITEM"
    FROM TBL_ROVE_GRADINGS
    WHERE bus_unit = :P2_BUSUNIT
    AND discipline = v_disc
    AND ((product = v_prod or product = 'all') or v_doprod = 'No')
    AND ((work_required = v_work or work_required = 'all') or v_dowork = 'No')
    AND ((core_system like '%'||v_core||'%' or core_system = 'all') or v_docore = 'No')
    order by item asc
    LOOP
    htp.prn('<option value="' || rec."ITEM"|| '">' || rec."ITEM"|| '</option>');
    END LOOP;
    htp.prn('</select>');
    END;
    This all works perfectly well. I can change my cascading selects, select items, refilter and select other items, the AJaX does its lovely stuff and I've got beautiful process flow. I can have the right-hand side populated from multiple different left-hand lists according to filtering choices.
    The problem is when I need to have the selected items remembered in session state. If I navigate away and then return my left-side has retained its session state (it's rebuilt onload from the currently selected cascading select values) but the right-hand side is blank.
    I've got a nasty suspicion that the core of the issue is because the left side may no longer have the values that the right-side session state is looking for to mark as 'selected'.
    Essentially, what I need is a solution that will 'force' the right-side to have the values previously selected for various filtered choices in the left.
    Any thoughts?
    Thanks :D

    Hello Frank,
    >> If I navigate away and then return my left-side has retained its session state
    I’m assuming that “navigate away” means redirecting from the page (without submitting it). In this case, the session state of the page is not saved, and none of the AJAX components you are using save it either, so you are left with a session state that represent page loading time.
    The addParam() method doesn’t save state. You should use the add() method, which do set session state. For example
    get.add(' P2_PRODFILTER',$v('P2_PRODFILTER'));This will save the session state for all your select lists. Of course, you will have to change the on-demand process accordingly.
    The second thing is to handle the shuttle value. You need to remember that for the APEX engine, a shuttle value is a colon-delimited string. You should generate this value in your on-demand process, and use the APEX_UTIL.SET_SESSION_STATE procedure to save it into session state. If you anticipate that this value will include options that don’t exist on your shuttle left side (left is relative, so let’s say your source column) you should set the LOV option of “Display Extra Values” to Yes.
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • Checkbox in Tabular Form (Solution to span multiple pages)

    Hi,
    We had a case where a large report needed to have check boxes. These check boxes would populate a list of id's which we then processed for a specific task. By default APEX doesn't support this.
    After spending some time on this, I thought I'd post my solution to help any others who experience the same problems. For this example we will use P10
    1. Create a new "normal" report.
    SELECT e.*, APEX_ITEM.CHECKBOX(1,e.EMPNO,'onClick="updateList(this);"',:P10_LIST, ',') AS Cancel,
    FROM emp e
    2. Create a hidden item called P10_LIST
    3. Add an HTML region to the page whose template is "No Template" (do this so it doesn't show up. Call the region "JavaScript". Set its sequence to 1
    4. Add the following in the JavaScript region:
    <script src="http://SERVER_NAME/String.js" type="text/javascript"></script>
    <script src="http://SERVER_NAME/Ajax.js" type="text/javascript"></script>
    <script type="text/javascript">
    function updateList(pObject){
    vItem = 'P10_LIST';
    myAjax = new Ajax();
    vList = myAjax.getItemValue(vItem);
    //Determine to remove or add from list
    if (pObject.checked) {
    //Add item
    vList = vList.listAppend(pObject.value);
    else{
    //Remove from list
    vList = vList.listRemoveItem(pObject.value);
    }//if
    //Set the session value
    myAjax.setItemValue(vItem,vList);
    //Set the HTML value
    document.getElementById(vItem).value = vList;
    </script>
    This script:
    - Loads the List from the session
    - Modifies the list
    - Stores it in the session
    5. The JavaScript region references 2 files, which you'll need to add to your server. They are as follows:
    Ajax.js
    function Ajax(){
    // TODO: Enter proper names etc.
    this.appProcessNameNull = 'AJAX_null';
    this.appProcessNameReturnItem = 'AJAX_ReturnItem';
    this.tempItem = 'P0_AJAX_TEMP';
    * TODO: Document
    * Sets Item in session
    Ajax.prototype.setItemValue = function(pItem,pValue,pAppProcess){
    if (pAppProcess == null)
    pAppProcess = this.appProcessNameNull;
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=' + pAppProcess,0);
    get.add(pItem,pValue);
    gReturn = get.get();
    * TODO: Document
    * @param pItem Name of item to get
    * @param pTempItem Name of temp item
    * @param pAppProcess Application Process to call which will return item
    * @return session value
    Ajax.prototype.getItemValue = function(pItem,pTempItem,pAppProcess){
    if (pTempItem == null)
    pTempItem = this.tempItem;
    if (pAppProcess == null)
    pAppProcess = this.appProcessNameReturnItem;
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=' + pAppProcess,0);
    get.add(pTempItem,pItem);
    gReturn = get.get();
    return gReturn;
    String.js
    // From http://www.somacon.com/p355.php
    String.prototype.trim = function() {
         return this.replace(/^\s+|\s+$/g,"");
    // From http://www.somacon.com/p355.php
    String.prototype.ltrim = function() {
         return this.replace(/^\s+/,"");
    // From http://www.somacon.com/p355.php
    String.prototype.rtrim = function() {
         return this.replace(/\s+$/,"");
    * Appends value to list
    * @param pValue Value to add to list
    * @param pDelimeter Defaults to comman
    String.prototype.listAppend = function(pValue, pDelimeter){
    if (pDelimeter == null)
    pDelimeter = ',';
    vStr = this;
    if (vStr.length == 0)
    vStr = pValue;
    else
    vStr = vStr + pDelimeter + pValue;
    return vStr;
    * Removes a value from list
    * @param pValue Value to remove from list
    * @param pDelimeter Defaults to comman
    String.prototype.listRemoveItem = function(pValue, pDelimeter){
    if (pDelimeter == null)
    pDelimeter = ',';
    vStr = this;
    vStr = pDelimeter + vStr + pDelimeter;
    // Remove value
    vStr = vStr.replace(pDelimeter + pValue + pDelimeter, pDelimeter);
    //Remove prefix and suffix items
    if (vStr.length > 0 & vStr.charAt(0) == pDelimeter){
    vStr = vStr.substring(1);
    if (vStr.length > 0 & vStr.charAt(vStr.length-1) == pDelimeter){
    vStr = vStr.substring(0,vStr.length - 1);
    return vStr;
    6. On Page 0 Create a hidden Item called: P0_AJAX_TEMP
    (Note: this is can be used for all your AJAX calls)
    7. Create an Application Process called: "AJAX_null". Process Text: null;
    8. Create an Application Process called: "AJAX_ReturnItem". Process Text:
    begin
    htp.prn(v(v('P0_AJAX_TEMP')));
    end;
    If you look at the Ajax.js you'll notice points 6,7, and 8 are all customizable etc... I just put it in so you can test right away.
    Now the user can select items on multiple pages (if pagination applies). Once they hit a submit button you can use P10_LIST to process your values.
    Hope this helps.
    Martin

    Hi Martin,
    I was trying to use your funda in my App. But i dont know why it is not doing anything.
    Also i'm facing a very small but severe problem with one of my report. I am using checkbox. So that user will be able to select all those records he/she wants. but the problem is that when i'm selecting few records with the help of the check boxes, selections are there. When moving to other page and coming back to that page, selections are gone. I think selections should not go like this. Otherwise the user will get confused.
    Can you tell me how can retain the check box selections??
    Thanks
    Sudipta

  • Use of Ajax to update a particular div in my code....using columnchart

    Hi All,
    I am having two columncharts, say columnChart1 and columnChart2.
    I want to display the columnChart2 in the place of columnChart1 when I select one particluar checkbox.
    I tried to implement and i reached here, "I am able to modify the existing graph with text and numeric but if i tried to put the new graph, i am getting the attached screen"...
    Here is my part of code where i am trying to update the graph,
    var oCB=new sap.ui.commons.CheckBox("compare",
      text:"Compare with Previous Year",
      checked : false,
      change : function() {
      if(oCB.getChecked()){
      alert('YES');
      //postRequest(oBarChart1);
      loadXMLDoc();
      else{
      alert('NO')
    function loadXMLDoc()
      var arun=10;
      alert("arundj");
    var xmlhttp;
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.onreadystatechange=function()
      alert("justoutside");
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
       alert("inside");
        document.getElementById("oColumnChart").innerHTML=oColumnChart1;
    xmlhttp.open("GET","",true);
    xmlhttp.send();
    there is no issue with the charts both are fine if I try to draw them separately. How to do this?
    Regards,
    Arun

    Hi Arun,
    If you would like to just change the content of the chart than I would recommend below solution.
    This way you don't have to worry about AJAX calls and UI takes care of them.
    var oModel = new sap.ui.model.json.JSONModel({
    data : [ {
    country : 'France',
    product : 'quadcopter',
    sales : 34
    country : 'USA',
    product : 'quadcopter',
    sales : 40
    country : 'China',
    product : 'tricopter',
    sales : 65
    country : 'France',
    product : 'tricopter',
    sales : 10
    country : 'China',
    product : 'quadcopter',
    sales : 50
    country : 'Germany',
    product : 'tricopter',
    sales : 15
    country : 'USA',
    product : 'tricopter',
    sales : 22
    country : 'USA',
    product : 'heli',
    sales : 96
    country : 'China',
    product : 'airplane',
    sales : 86
    country : 'France',
    product : 'airplane',
    sales : 76
    country : 'Germany',
    product : 'airplane',
    sales : 58
    country : 'USA',
    product : 'airplane',
    sales : 96
    country : 'China',
    product : 'heli',
    sales : 26
    country : 'France',
    product : 'heli',
    sales : 71
    country : 'Germany',
    product : 'heli',
    sales : 76
    data_new : [ {
    quantity : '10',
    product : 'quadcopter',
    sales : 34
    quantity : '16',
    product : 'quadcopter',
    sales : 40
    quantity : '20',
    product : 'tricopter',
    sales : 65
    quantity : '86',
    product : 'tricopter',
    sales : 10
    quantity : '91',
    product : 'quadcopter',
    sales : 50
    quantity : '45',
    product : 'tricopter',
    sales : 15
    quantity : '70',
    product : 'tricopter',
    sales : 22
    quantity : '37',
    product : 'heli',
    sales : 96
    quantity : '55',
    product : 'airplane',
    sales : 86
    quantity : '29',
    product : 'airplane',
    sales : 76
    quantity : '68',
    product : 'airplane',
    sales : 58
    quantity : '79',
    product : 'airplane',
    sales : 96
    quantity : '81',
    product : 'heli',
    sales : 26
    quantity : '69',
    product : 'heli',
    sales : 71
    quantity : '87',
    product : 'heli',
    sales : 76
    sap.ui.getCore().setModel(oModel);
    var dataset = new sap.viz.ui5.data.FlattenedDataset({
    dimensions : [ {
    axis : 1,
    name : 'Country',
    value : "{country}"
    axis : 2,
    name : 'Product',
    value : "{product}"
    measures : [ {
    name : 'Sales',
    value : '{sales}'
    data : {
    path : "/data"
    var dataset_new = new sap.viz.ui5.data.FlattenedDataset({
    dimensions : [ {
    axis : 1,
    name : 'product',
    value : "{product}"
    axis : 2,
    name : 'quantity',
    value : "{quantity}"
    measures : [ {
    name : 'Sales',
    value : '{sales}'
    data : {
    path : "/data_new"
    var oChart = new sap.viz.ui5.StackedColumn("chart", {
    width : "100%",
    height : "200px",
    title : {
    visible : true,
    text : 'Test Stacked Column Chart'
    var oCB = new sap.ui.commons.CheckBox("compare", {
    text : "Compare with Previous Year",
    checked : false,
    change : function() {
    if (oCB.getChecked()) {
    oChart.destroyDataset(dataset);
    oChart.setDataset(dataset_new);
    oChart.rerender();
    } else {
    oChart.destroyDataset(dataset_new);
    oChart.setDataset(dataset);
    oChart.rerender();

  • I built a basic Checkbox web page.  I want to add a time stamp everytime a check is made on the page.  How do I do that?

    I built a basic "checkbox page" with a list of bus numbers next to a check box.  once the check is made, I want Dreamweaver to insert the time that it was pressed right next to the bus number.  How do I do this?
    Any suggestions would be great.

    > I want Dreamweaver to insert the time that it was pressed right next to the bus number
    Sorry, Dreamweaver is just a development tool. You wouldn't have it insert the time. Your dynamic web page would do that.
    The best way would be to use AJAX, but a simpler method would be to have the checkbox trigger an event to submit the form. Then update the database with the timestamp. However, either method have the problem in that if the wrong checkbox is accidentally checked the form gets submitted. I think it would be better to use a submit button.
    Of course, all of this assumes you know Javascript and PHP or another scripting language and have a database setup.

  • Using AJAX to load city, state, metro area based on zip code

    I'm new to getting APEX to work with AJAX properly. I've been reading some tutorials and trying to apply what they do to my situation, but I'm running into a problem. I have a text field item for zip code. What I want to happen is that when someone enters in a zip code, I want to use AJAX to populate 3 different select lists (1 each for state, city, and metro area) and to populate a checkbox (of neighborhoods based on the zip code as well). I'm looking at the examples in:
    http://www.oraclealchemist.com/wp-content/uploads/2006/11/s281946.pdf
    and
    http://apex.oracle.com/pls/otn/f?p=11933:63
    But they all use examples where the value of a text field item is used to populate 1 select list. I can't figure out how to apply that methodology to populate 3 select lists and 1 checkbox item. I've got all my SELECT statements written to populate these fields based on the value of the zip code text field item, but don't know how to convert what I already have to use AJAX.
    Here are my SELECT statements:
    P2805_STATE lov:
    ===========================================================================================
    SELECT INITCAP(GEO_DATA_STATE.STATEFULLNAME) d,GEO_DATA_STATE.STATE v
    FROM GEO_DATA_STATE, GEO_DATA_ZIP
    WHERE isPrimary = 'P' and
    trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
    GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
    ORDER BY STATEFULLNAME
    P2805_CITY lov:
    ===========================================================================================
    SELECT UNIQUE (INITCAP(GEO_DATA_CITY.CITY)) d,GEO_DATA_CITY.CITY v
    FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_CITY
    WHERE
    trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
    trim(upper(GEO_DATA_ZIP.CITY)) = trim(upper(GEO_DATA_CITY.CITY)) and
    GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
    ORDER BY GEO_DATA_CITY.CITY
    P2805_METRO_AREA lov:
    ===========================================================================================
    SELECT UNIQUE (INITCAP(GEO_DATA_METRO.METRO_AREA)) d,GEO_DATA_METRO.CODE v
    FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_METRO
    WHERE
    trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
    trim(upper(GEO_DATA_ZIP.METROCODE)) = trim(upper(GEO_DATA_METRO.CODE)) and
    GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
    ORDER BY 1
    P2805_NEIGHBORHOOD lov:
    ===========================================================================================
    SELECT UNIQUE (INITCAP(GEO_DATA_HOOD.HOOD)) d,GEO_DATA_HOOD.HOOD v
    FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_METRO, GEO_DATA_HOOD
    WHERE
    trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
    trim(upper(GEO_DATA_ZIP.METROCODE)) = trim(upper(GEO_DATA_METRO.CODE)) and
    GEO_DATA_HOOD.METRO_CODE = GEO_DATA_METRO.CODE and
    GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
    ORDER BY 1Do all these statements need to go in 1 on-demand process? Where do I go from here?

    Andy, cool. This is starting to make more sense. THANKS A BUNCH! OK. I've gone ahead and modified the on demand process to suit my needs, so I have:
    begin
      owa_util.mime_header('text/xml', FALSE );
      htp.p('Cache-Control: no-cache');
      htp.p('Pragma: no-cache');
      owa_util.http_header_close;
      -- Building States list
      htp.prn('&lt;SELECT&gt;');
      FOR i in (
        SELECT INITCAP(GEO_DATA_STATE.STATEFULLNAME) d, GEO_DATA_STATE.STATE v
        FROM GEO_DATA_STATE, GEO_DATA_ZIP
        WHERE isPrimary = 'P' and
        trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
        GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
        ORDER BY STATEFULLNAME
      LOOP
        htp.prn('&lt;OPTION VALUE=''' || i.v || '''&gt;' || i.d || '&lt;/OPTION&gt;');
      END LOOP;
      htp.prn('&lt;/SELECT&gt;');
      -- Building Cities list
      htp.prn('&lt;SELECT&gt;');
      FOR i in (
        SELECT UNIQUE (INITCAP(GEO_DATA_CITY.CITY)) d, GEO_DATA_CITY.CITY v
        FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_CITY
        WHERE
        trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
        trim(upper(GEO_DATA_ZIP.CITY)) = trim(upper(GEO_DATA_CITY.CITY)) and
        GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
        ORDER BY GEO_DATA_CITY.CITY
      LOOP
        htp.prn('&lt;OPTION VALUE=''' || i.v || '''&gt;' || i.d || '&lt;/OPTION&gt;');
      END LOOP;
      htp.prn('&lt;/SELECT&gt;');
      -- Building Metro Area list
      htp.prn('&lt;SELECT&gt;');
      FOR i in (
        SELECT UNIQUE (INITCAP(GEO_DATA_METRO.METRO_AREA)) d, GEO_DATA_METRO.CODE v
        FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_METRO
        WHERE
        trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
        trim(upper(GEO_DATA_ZIP.METROCODE)) = trim(upper(GEO_DATA_METRO.CODE)) and
        GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
        ORDER BY 1
      LOOP
        htp.prn('&lt;OPTION VALUE=''' || i.v || '''&gt;' || i.d || '&lt;/OPTION&gt;');
      END LOOP;
      htp.prn('&lt;/SELECT&gt;');
      -- Building Neighborhood list
      htp.prn('&lt;SELECT&gt;');
      FOR i in (
        SELECT UNIQUE (INITCAP(GEO_DATA_HOOD.HOOD)) d, GEO_DATA_HOOD.HOOD v
        FROM GEO_DATA_STATE, GEO_DATA_ZIP, GEO_DATA_METRO, GEO_DATA_HOOD
        WHERE
        trim(upper(GEO_DATA_ZIP.STATE)) = trim(upper(GEO_DATA_STATE.STATE)) and
        trim(upper(GEO_DATA_ZIP.METROCODE)) = trim(upper(GEO_DATA_METRO.CODE)) and
        GEO_DATA_HOOD.METRO_CODE = GEO_DATA_METRO.CODE and
        GEO_DATA_ZIP.ZIPCODE = :P2805_ZIPCODE
        ORDER BY 1
      LOOP
        htp.prn('&lt;OPTION VALUE=''' || i.v || '''&gt;' || i.d || '&lt;/OPTION&gt;');
      END LOOP;
      htp.prn('&lt;/SELECT&gt;');
    end;It doesn't look like I would have to modify the appendToSelect function at all, correct? Is the checkbox that I need to populate handled the same way as these select lists? And it seems like I only need to make the 2 changes that you mentioned to get_AJAX_SELECT_XML function, right? So my javascript function should be like:
    &lt;script language="JavaScript1.1" type="text/javascript"&gt;
    function get_AJAX_SELECT_XML(pThis,pSelect1,pSelect2,pSelect3,pSelect4){
    if  (document.getElementById('P2805_ZIPCODE').value.length == 5)
         var l_Return = null;
         var l_Select1 = $x(pSelect1);
         var l_Select2 = $x(pSelect2);
         var l_Select3 = $x(pSelect3);
         var l_Select4 = $x(pSelect4);
         var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=otn_Select_XML',0);
         get.add('TEMPORARY_ITEM',pThis.value);
         gReturn = get.get('XML');
         var sels = gReturn.getElementsByTagName("select");
         if(gReturn && l_Select1){
              var l_Count = sels[0].getElementsByTagName("option").length;
              l_Select1.length = 0;
              for(var i=0;i<l_Count;i++){
                   var l_Opt_Xml = sels[0].getElementsByTagName("option");
                   appendToSelect(l_Select1, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
         if(gReturn && l_Select2){
              var l_Count = sels[1].getElementsByTagName("option").length;
              l_Select2.length = 0;
              for(var i=0;i<l_Count;i++){
                   var l_Opt_Xml = sels[1].getElementsByTagName("option")[i];
                   appendToSelect(l_Select2, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
         if(gReturn && l_Select3){
              var l_Count = sels[2].getElementsByTagName("option").length;
              l_Select3.length = 0;
              for(var i=0;i<l_Count;i++){
                   var l_Opt_Xml = sels[2].getElementsByTagName("option")[i];
                   appendToSelect(l_Select3, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
         if(gReturn && l_Select4){
              var l_Count = sels[3].getElementsByTagName("option").length;
              l_Select4.length = 0;
              for(var i=0;i<l_Count;i++){
                   var l_Opt_Xml = sels[3].getElementsByTagName("option")[i];
                   appendToSelect(l_Select4, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue)
         get = null;
    &lt;/script&gt;
    And then since all 4 items (3 select lists and 1 checkbox item) are populated based on the value inputted in the text field item, I would only need to add the following to the html form element attribute of my text field item, right?
    onKeyUp="javascript:get_AJAX_SELECT_XML(this,'P2805_STATE','P2805_CITY','P2805_METRO_AREA','P2805_NEIGHBORHOOD');"Denes, thanks for the example. It seems like what I need to do is somewhere inbetween what you have and what's in the example on http://apex.oracle.com/pls/otn/f?p=11933:37. I have 3 select lists and 1 checkbox item that should all be populate depending on the value entered for the text item. Do I still need to split everything up then into a function and an on demand process for each select list and checkbox?

  • Change Value of HTMLDB_ITEM using HTMLDB_ITEM.CHECKbox

    Hello,
    I've got a region with a 'pl/sql function returning sql query'
    declare
    q varchar2(4000);
    begin
    q:=' select htmldb_item.checkbox(1,t.jedi_ean_id) as Auswahl, ';
    q:=q||' t.ean, j.artikelbezeichnung, ';
    q:=q||' t.artikelmengeneinheit, ';
    q:=q||' htmldb_item.text(2,t.iln) as ILN, ';
    q:=q||' from malus.jedi_ean t; ';
    return q;
    end;
    My Query return for example 10 rows. Now I want to check 5 of this 10 rows using the checkbox.
    With the following PROCESS i am able to save the new values of the field ILN to the Database.
    for i in 1..HTMLDB_APPLICATION.G_F01.COUNT
    loop
    update jedi_ean j
    set j.iln = HTMLDB_APPLICATION.G_F02(i),
    where j.jedi_ean_id = HTMLDB_APPLICATION.G_F01(i);
    end loop;
    Now to my Problem:
    I want to have an input field outside of this report where the user can manually set the value of the field ILN.
    Afterwards the user checks 5 of the 10 rows and then he should have the possibility to click on a button
    to assign these values to the 5 checked rows in the report, not in the database.
    After this step the user should click on a submit button an start the existing process above.
    Is this possible??

    Hi,
    I do not know can you do that with dynamic action or is there of of box solution.
    But see this example
    https://apex.oracle.com/pls/apex/f?p=40323:30
    You can bind onchange event to text field, and call Ajax to get emp name.
    Then use sample JavaScript to set value to display only item
    Regards,
    Jari

  • Question on Dynamic Select Lists and Checkboxes

    Hello,
    I am new to APEX, and this is my first posting, I have a question about how to implement dynamic checkboxes from a select list.
    Basically I would have a select list, and based on what item is selected a set of checkboxes would appear.
    I was originally using the Select and Submit property on the select box, which works fine, all of the checkboxes appear appropriately. But the thing is, APEX refreshes the page each time, and since this select box is lower in the page, the user would have to scroll all the way down to where they were before.
    The main requirement is so that the user won't have to scroll down the that position where the select box is each time they select a new option.
    So a work around attempt is to create a javascript that will automatically scroll down to that position on page load ...
    i.e.
    function pageScroll() {
    window.scrollBy(0,50);
    But that didn't work, because for some reason the javascript wasn't appearing.
    Is there a way to either:
    1. Have a dynamic checkbox appear using ajax? -or-
    2. Have the javascript scrolling effect
    Sorry if this is a confusing question, I was wondering if anyone else came across this issue.
    Thanks in advance!!

    Since this Select List plays such an important role on the page, why not create a side-region and put that select list there so you don't have to overwhelm the user and his 'persistence of vision ' with a page that scrolls all by itself to the 1000th line to, then , change the options ?
    just an idea.

  • Updating checkbox in realtime based on other table

    Hi All,
    using apex 2.2.1, database 10.2.0.3
    I have a check box that I want to update based on the user selecting a radio box. e.g. Once the user has updated the radio box the checkbox is either switch on or off.
    I understand this needs to be done via a javascript but the issue I'm facing is that I need to do a SQL statement to get the the correct value as it is on another table.
    cheers
    James

    After doing more searching I'm pretty sure I need to call PL/SQL in a javascript. I'm new to all this and the only examples seem to complicated to understand.
    I'm sure someone has done this before. I would be gratefull if some could post their PL/SQL and the javascript / AJAX into this note so I can reverse engineer it.
    cheers
    James

  • Read interactive report checkbox on submit

    NEWBIE QUESTION: How can you determine which row's checkbox in an interactive report is checked on a button submit process?

    Hi,
    This post might help
    Re: Need help with APEX_Collection
    Use Ajax to store checked rows to collection
    Regards,
    Jari

  • Ajax Query

    Hi,
    I have a button on a page that when I press, calls a javascript function within a .js include file to call an onDemand process to add members to an apex collection.
    Basically javascript function is like:
    function processCollection() {
      var get = new htmldb_Get(null,html_GetElement('pFlowId').value,'APPLICATION_PROCESS=processAppColl',0);
    }OnDemand process is like:
    Name:processAppColl:
    BEGIN
      apex_collection.add_member (
         p_collection_name => 'coll1',
         c001 = > uid,
         c002 => first_nm,
         c003 => last_nm);
    END;Unfortunately, this doesn't seem to be working and by placing a debug statement within the onDemand process, it doesn't look like that the actual application process is being called from the javascript function.
    My queries:
    1) With my javascript function being called from within an include js library, is the above javascript function correct with regards to the way I want it to just execute the onDemand process?
    2) Does the js include library know about pFlowId ?
    3) Is the overall process I'm using correct?
    Any assistance would be much appreciated.
    Thanks.
    Tony.

    Hi,
    My javascript now looks like:
    function processCollection() {
    var get = new htmldb_Get(null,html_GetElement('pFlowId').value,'APPLICATION_PROCESS=process_asset_mgr_collection',0);
    gReturn = get.get();
    My On Demand process looks like:
    Name: process_asset_mgr_collection
    DECLARE
    BEGIN
      APEX_COLLECTION.TRUNCATE_COLLECTION(
                          p_collection_name => 'ASSET_MGR_SEL' );
      FOR i IN 1..APEX_APPLICATION.G_F45.COUNT LOOP
        v_user_dtls := BA_APP.get_user_details(APEX_APPLICATION.G_F45(i));
        OPEN  c_get_grp_nm (APEX_APPLICATION.G_F45(i));
        FETCH c_get_grp_nm INTO v_grp_nm;
        CLOSE c_get_grp_nm;
        APEX_COLLECTION.add_member(
            p_collection_name => 'ASSET_MGR_SEL',
            p_c001            => APEX_APPLICATION.G_F45(i),  -- MAGS
            p_c002            => v_grp_nm,                   -- Group Name
            p_c003            => v_user_dtls.first_name||' '||
                                 v_user_dtls.last_name,      -- Staff Name
            p_c004            => v_user_dtls.email,          -- E-mail
            p_c005            => :BA_APP_NAME);              -- BA App Name
      END LOOP;
      COMMIT;
    END;From what I can see, it doesn't seem to be working because I think it doesn't know what the value is for APEX_APPLICATION.G_F45.COUNT which is a checkbox item on the main page which holds the UID where I can check a number of rows.
    Basically, on the main page, if I check 5 rows and each of these 5 rows holds 5 unique User IDs, I need to be able to pass this information into the On Demand process to process the collection to retrieve and store additional info.
    Not sure how to accomplish this using Ajax.
    Hope this makes sense.
    Thanks.
    Tony.
    ps Just added: I am now having the problem that the On Demand process from ajax is not firing at all now - not sure why?
    Message was edited by:
    tfatouro

  • CF/Ajax - How to pass parameters to a cfwindow?

    Hi,
    Is there a way to pass parameters to a cfwindow?
    If yes, please provide me with all relevant details.
    HERE IS MY SITUATION:
    I have a form, in which I'm looping over a recordset e.g.
    <cfform name="frmTest">
         <cfset counter = 0>
         <cfloop query="variables.qTest">
              <cfset counter = variables.counter + 1>
              <cfinput
                   type="checkbox"
                   name="test_#variables.counter#_ch"
                   onClick="showPopUp(#variables.qTest.id#,#variables.qTest.amount#)">
         </cfloop>
    </cfform>
    Here is my javascript / ajax:
    <script type="text/javascript">
    <!--
    function showPopUp(id,amt){
    ColdFusion.Window.show("approvalWindow");
    //-->
    </script>
    And here is my cfwindow:
    <cfwindow
                name="approvalWindow" center="true" closable="true"
                draggable="false" modal="true" title="Approval"
                initshow="false" width="680" height="315">
    HOW CAN I OBTAIN THE VALUES OF id AND amt HERE?
    E.g.
    <cfset idClicked = id>
    <cfset amtClicked = amt>
    I'll be needing those 2 variables for further processing...
    </cfwindow>
    I know I could have used a simple javascript window.open and passed those 2 parameters in the URL scope, but, I don't want my users to see what id I'm sending.
    Thanks and regards,
    Yogesh Mahadnac.

    Hi,
    Many thanks for your answer.
    It actually works under "static" conditions, i.e. if I'm calling the cfwindow inside a cfloop, the value of ID is not refreshed.
    Let me show you what I mean.
    For example, here is my form
    <cfform name="frmTest">
         <cfset counter = 0>
         <cfloop query="variables.qTest">
              <cfset counter = variables.counter + 1>
              <cfinput
                   type="checkbox"
                   name="test_#variables.counter#_ch"
                   onClick="showPopUp(#variables.qTest.id#,#variables.qTest.amount#)">
         </cfloop>
    </cfform>
    This gives the output, e.g.
    Checkbox 1
    Checkbox 2
    Checkbox 3
    Checkbox 4
    Checkbox 5
    ID 1
    ID 2
    ID 3
    ID 4
    ID 5
    showPopUp(1,10)
    showPopUp(2,15)
    showPopUp(3,12)
    showPopUp(4,15)
    showPopUp(5,50)
    Now, here is the showPopUp part (using the solution you provided to me):
    <cfajaximport tags="cfwindow">
    <script type="text/javascript">
    <!--
        function showPopUp(id,amt){
            ColdFusion.Window.create('Window1','Window Title','test.cfm?ID='+ id + '&amt=' + amt,
            {_cf_refreshOnShow:true,height:290,width:630,modal:true,closable:true,draggable:true,resi zable:false,center:true,initshow:true});
    //-->
    </script>
    And then on test.cfm, we can easily obtain the value of ID and amt using the url scope
    <cfset id = url.ID>
    <cfset amt = url.amt>
    <cfdump var="#url#" label="Checking values sent from checkbox">
    Normally, the value of ID should be 1, 2, 3, 4 or 5 depending on the checkbox you click, right?
    When you click the 1st one, ID 1 is sent in the url (this is fine).
    However, if you click the 3rd checkbox after having clicked the 1st one, the value of ID and amt still reflect that of the 1st checkbox.
    It is not "refreshed" to 3 and 12, you still get ID = 1 and amt = 10.
    Is there anything we missed in the showPopUp script?
    Thanks and regards,
    Yogesh Mahadnac.

  • Sun IdM and ajax?

    I'm a developer new to Sun IdM. In looking at our existing IdM pages they are painful to say the least. Every single action on them requires the whole page to re-load. I have used ajax in a LAMP sort of setup before and I know there are ways you can implement it on Java/JSP but what I'm wondering is if anyone on this forum has tried this and if it has made a difference at all.
    Thanks Much

    Hi,
    I did this for a little demo before. The challenge is to make the data available for the ajax client in the browser to pick up dynamically.
    What I did in my demo was that the form put the valid choices into a static variable of a custom class. The user could then type in a textbox and as soon as the number of matched items was less than 5 they where displayed for choice. The scenario was to show a way to pick from a big amount of choices without sending out megabytes of checkboxes and having the user scrolling through thausands of lines to find what he is looking for. Of course in a clustered environment the static variable may not be the right sollution.
    Regards,
    Patrick

  • Can Flex do dynamic UI like AJAX?

    With CGI or AJAX apps, if I want a checkbox for each of a
    number of items returned by the server, I can just have the server
    spit out a bunch of checkbox HTML elements, then set them as the
    innerHTML for some div.
    Since Flex is compiled, it doesn't seem like this is
    possible. Is there a way to have any number of checkboxes
    dynamically generated based on output from a server?

    "trustme73" <[email protected]> wrote in
    message
    news:g95ksf$32n$[email protected]..
    > My requirement is slightly different. I am generating a
    html layout in the
    > server(html form with the list of input boxes and
    buttons). When the
    > browser
    > receives this layout it just renders the page. I want to
    convert this to
    > flash
    > UI. But flash has swf file which is complied. How can i
    convert html page
    > to
    > flash ui(swf file)?. Here the html page is dynamically
    generated one and
    > the
    > number of controls and the layout info will be decided
    at runtime.
    If your HTML is valid XHTML, you should be able to use e4x to
    walk the tree
    and display equivalent items. But since you have it working,
    why not just
    leave it alone?

Maybe you are looking for