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

Similar Messages

  • AJAX Query, Refresh Spry

    Here is the snippet of code I am using on a master/detail
    page (Using spry). The goal is to delete the employee, and upon
    completion have the master list use a blind up effect to get rid of
    that row in the list.
    function deleteEmployee() {
    var test = $('employeeIdSpan').innerHTML;
    var url = "../ajax/deleteEmployee.php?employee_id=" + test;
    new Ajax.Updater('detail', url,
    method:'get',
    onSuccess: function() {
    var masterList = Spry.Data.getRegion('employee_list');
    //masterList.loadData();
    var currentId = test;
    //test is $('employee_id').innerHTML b/c we haven't figured
    out how to dynamically show the current users id to the javascript.
    var blindEffect = "masterEmployee" + currentId;
    //Effect.BlindUp(blindEffect);
    Effect.Fade('detail', {from:"100", to:"0"});
    onFailure: function() {
    alert('Something Went Wrong');
    However, it's not working......the Effect.BindUp is breaking
    it and I can't figure out why.
    Thanks :)
    Also, if anyone could be so kind to help me w/ this...
    //test is $('employee_id').innerHTML b/c we haven't figured
    out how to dynamically show the current users id to the javascript.

    what version of Spry are u using.
    check out this topic:
    http://labs.adobe.com/technologies/spry/articles/effects_migration/effects_migration.htm
    If u havent found any solution yet, please provide me with an
    url of the page so i can take a closer look.

  • How to form an Endeca query where a field must start with certain letters

    hi, Is it possible to form an Endeca query to retrieve a field that must start with certain letters? Say like get all users who's first letter is 'A' ? I checked with Range filters but it is supporting only numerical fields as well as Wild card search. But nothing worked well so far. any suggestion?

    Yes. Here's the gist of how it works:
    Typeahead is commonly implemented by enabling wildcard search on one or more Dimensions. An AJAX query is sent out containing the beginning of a search term. A controller in the app layer answers that AJAX query and formulates an Endeca Dimension Search query. It sends that off to the Endeca MDEX engine. Endeca responds with relevant Dimension matches. The controller returns these to the client who made the AJAX request. They are rendered as hyperlinks that lead to a particular navigation state in the catalog.

  • Is there any way of storing audio- / video-elements in the browser cache in Safari in iOS?

    Hi there,
    I'm desperatly trying to find a solution for a web application that has to run on an iOS-Safari (e.g. on iPad, iPad2 and iPhone 4):
    It's a web-application I wrote some time ago which lets the user search for and listen to short music samples (MP3s, all from ~100 kB to ~1.5 MB). The audio player is Flash-based, so it doesn't work on iOS-devices at the moment and I'll have to implement an alternative either in HTML 5 or with a "direct" QuickTime-object.
    Both my HTML 5- and QuickTime-alternatives for iOS-devices work fine so far, but there's one major problem I can't find a solution to:
    Unlike Flash and most HTML 5-capable browsers on Windows Safari on my iPad 2 won't store the audiofiles in the browsercache after loading and playing them - neither with HTML 5 audio-tags nor with a QuickTime-Object. Every time I load an audio file for playback from the server (with JavaScript-Commands, so without changing or reloading the whole page) it's downloaded again completely.
    If a user listens to sample A and then to sample B, Safari forgot about having played sample A and downloads the whole MP3 again if I like to listen to it again. On a mobile device with a potentially narrow bandwith this behaviour is out of the question.
    Is there a way of storing downloaded audiofiles opened by HTML 5 or QuickTime in Safari's cache so it remembers already having downloaded them  -  like it caches usual "web-files" like HTML, CSS or JPEG-images, or like Flash stores such objects in its local cache?
    The Application Cache with a manifest-file is not an option - this only seems to work if the browser is offline, for example if the iOS-device is in "Airplane"-Mode.

    Yes, I watched it. It contains interesting stuff I have to admit I didn't know yet, but unfortunately I still can't find a solution to my problem:
    My first attempt was trying to use the Application Cache with a manifest file - although this is not really the intended purpose for my application... I don't have a static set of files that I want to have cached or "available offline"  -  I just want to cache MP3s which the user has played yet.
    It should be possible to use a "dynamic manifest": One that is parsed by the Apache PHP module and listing the files played so far from a PHP session - something like this:
    <?php
    session_start();
    header("Content-Type: text/cache-manifest, charset=UTF-8");
    echo "CACHE MANIFEST\n";
    foreach($_SESSION['playedSongs'] as $song)
        echo $song."\n";
    ?>
    So whenever a song is loaded / played, I could access the PHP session with AJAX, insert the filename of the played file and manually update the manifest by calling window.applicationCache.update().
    There are two problems with this:
    First of all: It doesn't work. And I didn't even get to the point of trying to use a dynamic manifest:
    <!DOCTYPE html>   
    <html manifest="cache.manifest">
        <head>
            <title>Test</title>
            <script type="text/javascript">
            function playStuff(id)
                if(id == 1)
                    window.document.getElementById("audio").innerHTML = '<audio controls preload="automatic" autobuffer><source src="song01.mp3" type="audio/mp3" /></audio>';
                else if(id == 2)
                    window.document.getElementById("audio").innerHTML = '<audio controls preload="automatic" autobuffer><source src="song02.mp3" type="audio/mp3" /></audio>';
            </script>
        </head>
        <body>
            <div id="audio"></div><br />
            <br />
            <input type="button" value="playStuff(1)" onclick="playStuff(1)" />
            <input type="button" value="playStuff(2)" onclick="playStuff(2)" />
        </body>
    </html>
    The cache.manifest looks like this:
    CACHE MANIFEST
    song01.mp3
    song02.mp3
    and is properly returned from Apache as "text/cache-manifest" by adding
    AddType text/cache-manifest manifest
    to the .htaccess of this directory.
    The Apache-logs clearly show that the Safari (respectively "AppleCoreMedia") doesn't care about the application cache when it comes to audio-files:
    Safari itself seems to acknowledge the manifest and indeed preload the files:
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/index2.html HTTP/1.1" 200 2619 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/cache.manifest HTTP/1.1" 200 79 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/cache.manifest?%3E HTTP/1.1" 200 79 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/song02.mp3 HTTP/1.1" 200 120525 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/song01.mp3 HTTP/1.1" 200 120525 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    Up to this point I did nothing but opening my test-application in Safari.
    Playing song01.mp3:
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 2 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:29 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:29 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    Playing song2.mp3:
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 2 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:05 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:05 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    Playing song1.mp3 again:
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:40 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:40 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    Playing song2.mp3 again:
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:13 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:13 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    Every file is downloaded again completely when playing it. So "AppleCoreMedia" (whatever this may be exactly, the QuickTime-plugin that is triggered by the HTML 5 audio-element I suppose?) either doesn't have access to the Application Cache or simply just doesn't realize the files in it. So if I switch my iPad to "Airplane Mode" now, the Safari is unable to access / load / play the files.
    I also tried using a QuickTime-object instead of an HTML 5 audio-tag (as far as I know HTML 5 audio and video in Safari always use QuickTime?) and controlling it with something like:
    document.movie1.SetURL('song02.mp3');
    Nothing changes, it's just like using HTML 5 audio and everything gets downloaded again when loading/playing it.
    And even if this would work there'd still be a problem:
    To properly implement that I would have to load the MP3-file in the Application Cache before playing it. When doing this it seems impossible to show a "real" progress: The ProgressEvent that is fired from the Application Cache after updating it doesn't seem to provide any information about data loaded so far and the complete size of a file. It's just "File 1 from 2" and so on, and not a "real" progress where I could determine something like: "100 kB of 1.2 MB loaded" as I can with the audio-element.
    All the other storage-approaches like Web SQL / Web Database or Local Storage are no help either:
    I don't see any way of getting the MP3 data into Local Storage or Web Database or getting it out again to play it. The HTML 5 Canvas-element has a toDataURL()-function to produce a Base64-encoded representation and use it for storage  -  the Audio-element doesn't seem to have anything like this.
    My last really "dirty" approach was trying to load "manually" Base64-encoded-MP3s with a combination of AJAX and PHP: A PHP-script outputs a Base64-representation of a MP3-file and is loaded by AJAX, so I could store the Base64-representation e.g. as Local Storage or in Web Database:
    <?php
    $infile = 'song01.mp3';
    $contents = file_get_contents($infile);
    $base64 = base64_encode($contents);
    $audio = 'data:audio/mp3;base64,'.$base64.'';
    echo $audio;
    ?>
    I tried using the resulting AJAX responseText as the source-argument in an audio-source-tag. Suprise: It doesn't work in Safari on my iPad 2, the player just fails to load the "file", although this works fine in Chrome on Windows. Possibly a size limitation for Base64-URIs on Safari / iOS.
    And again: Even if this was working in iOS/Safari I don't know of a way to determine a real progress from an AJAX-query...
    The last thing I could think of is not replacing the audio- or source-tags when loading a song but leaving them in the DOM-structure, check if it's already there when a song is loaded and just add a new audio-tag if a song hasn't been loaded yet.
    This solution would be my last resort: I'd have to rewrite nearly the whole application to completely operate on JavaScript / AJAX to stay on one site in the browser - else the "cached" audio data would be lost again when changing to another site in Safari.
    Furthermore I think there'll be a small cache limit somewhere when doing this?
    Any ideas?

  • Htmldb_get object in IF statement

    Hi all,
    I I need to use the return object of htmldb_get method in a if statement after I make my AJAX query. Something like below:
    var get = new htmldb_Get(null,html_GetElement('pFlowId').value,'APPLICATION_PROCESS=APP_PROC',0);
    get.add('APP_ITEM',html_GetElement('P11_TEST').value)
    gReturn = get.get();
    if (gReturn=='0')
    // do some stuff
    I can get the value of gReturn by other means but need to use it in a IF statement. The gReturn will have a value of '0' or '1' outputted by the application process APP_PROC
    The code in above gives invalid character error in IE. Anyone please guide me the right way to use gReturn in if statement? Thanks.
    PS: I am definitely sure the issue is with the if(gReturn=='0') because if I do if (true) the rest of the javascript/ajax function executes without problem.
    Edited by: AI on 29/03/2012 21:01

    Adding a parameter to htmldb_Get is done through "addParam", not "add"?
    Have you tried to put an alert of your return?
    If you have firefox with firebug, look at the ajax call, look at your POST parameters, and look at your response. Maybe an error is being thrown instead of the number your expect?
    extra-curricular: I don't know which version of apex introduced the $v function, but it'd write easier than html_GetElement: $v('pFlowId'), or $('#pFlowId').val()

  • .click on row works with php table - does not work with javascript table.

    Howdy,
    I've run into a very interesting problem today, and I hope you'll be able to help me.
    I have a page in which the top is php to read a table from the server, and post the table as the html page is being built.
    The data come up as a table, and each row is clickable, that click moving the user to a different page, based on the row clicked.
    Here are the relevant parts of the php code:
    <?php
    echo "<table id='patienttable' cellpadding=5px border=0 font-size=16px>";
    echo "<tr><th width='30'>"."ID#"."</th><th width='100'>"."Last Name"."</th><th width='100'>"."First Name"."</th><th width='100'>".
    "Middle Name"."</th><th width='80'>"."DOB"."</th><th width='50'>"."Zip"."</th><th width='50'>"."Gender"."</th><th width='100'>".
    "Phone"."</th></tr>";
    while ($row = mysqli_fetch_array($result))
    blah blah blah
    echo "<tr><td id='localid'>".$localid. "</td><td>".$lastname. "</td><td>".$firstname. "</td><td>".$middlename."</td><td>".$dob."</td><td>".$physzip. "</td><td>".$gender."</td><td>".$phone1.       "</td></tr>";
      echo "</table>";
    ?>
    And here is the code to click on a row:
    $("#patienttable tr").click(function() {
           var passthis = $(this).find("#localid").html();
           $.post("php/setsessionvariable.php",
                  {sessionval: passthis},
         function(e) {window.location.href = "root.php"}
    EVERYTHING works great - no problems - working now for about 2 months.
    Today I started to build something similar, BUT! I cannot read from the database at the top of the page, I must do an ajax query, call the db, and post the data in a table;
    Here is the boring, fairly straight-forward javascript code:
    $.ajax({
        type: "POST",
        url: "findpatientbackend.php",
        data: {letterslastname: lastname},
        dataType : 'json',
        success: function(result) {
      $("#div1").html("");
            if(result.length >= 1)
       {var output = "";
             $("div1").html("<table id='findtable'>");
              $.each(result, function(index, value) {
                                                     output += "<tr><td width='100px'></td><td id='localid' width='100px'>"
                 + value.localid + "</td><td width='100px'>"
                 + value.lastname + "</td><td width='100px'>"
                 + value.firstname + "</td><td width='100px'>"
                 + value.middlename + "</td><td width='100px'>"
                 + value.dob + "</td></tr>";
                $("#div1").html(output);
             $("div1").html("</table>");  
        error : function() { alert("error on return"); }
    And here is the click row code, almost EXACTLY like the one above:
    $("#findtable tr").click(function() {
           var passthis = $(this).find("#localid").html();
           $.post("php/setsessionvariable.php",
                  {sessionval: passthis},
         function(e) {window.location.href = '../root.php'}
    All the "stuff" loaded onto the page just fine, BUT, absolutely nothing happens when I click a row.
    Playing around this afternoon, I did a "View Source" on both pages, and saw something VERY interesting;
    1 - The table written by PHP is present, can be seen, and therefore is "clickable" to the jquery .click function.
    2 - The table written by javascript is INVISIBLE! I cannot see it in the source view (but I can see it on the screen) and therefore the .click function can't see it either.
    Questions:
    1. How can I make the table written in javascript "clickable" - how can I make the javascript table "visible"?
    2. Could it be the use of ".html" to post the table to the div? Is there another way?
    And again, I thank you in advance for any help.

    I found the solution to my problem, and perhaps my comments here will help others.
    Thinking a bit more, I wrote a separate javascript routine that created a table, allowed it to be styled, and allowed it to be clickable.
    Here is the code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js" type="text/javascript"></script>
    <style>
    #findtable {
    width:200px;
    background-color:#CFD3FE;
    margin:10px auto;
    text-align:center;}
    </style>
    <body>
    <div id="puttablehere"></div>
    <script>
    $(document).ready(function () {
    var output = "<table id='findtable'>";
    for (var i = 0; i<15; i++) {output += "<tr><td width='100px'>X</td><td id='localid' width='100px'>X</td></tr>";}
    output += "</table>";
    $("#puttablehere").html(output);
    $("#findtable tr").click(function(e) { alert("it works!"); });
    </script>
    </body>
    </html>
    The initial code I posted was creating the table the wrong way.
    You have to create the WHOLE table at the same time, and post it all at once.
    The code above does that.
    My learning points are:
    1. To create a table in javascript, and post it with a $("#puttablehere").html(output); call, you must put the ENTIRE table into that single string variable called "output" (or whatever you want to call it).
    2. Everytime you call a jqeury .html function like this: ---("#puttablehere").html(output); -- It COMPLETELY over-writes the whole div/tr/td block that it is pointed at.
    3. If you create a table in javascript (client side) you cannot see it with "View Source" - because what is posted in the table is AFTER the DOM is loaded.
    Creating a table with php server side - you CAN see, because it is posted with the DOM.
    So I thank you for your ideas, and I hope this may help another noob, such as myself, in the future.
    Adios!

  • Invalid month sql request for chart

    Hi,
    i try to refresh a report with a dynamical sql request as following :
    select NULL LINK, status_label LABEL, count(fcr.status_code) as VALUE
    from table
    where table.date > '05/06/2007'
    This query is generated dynamicaly from a date picker.
    My problem is that the chart witch should be refreshed by this query, isn't.
    The following error message come from the ajax query :
    chart Flash Chart error: ORA-20987: APEX - Flash Chart error:  - ORA-20001: Fetch error: ORA-01843: not a valid month
    Something disapoint me: when i execute the query in plSQL i have got my wished results.
    Does someone have any idea about this mistake?

    Hi better,
    Try to give
    where table.date >to_date( '05/06/2007','dd/mm/yyyy');Brgds,
    Mini
    Mark Answers Promptly

  • Tooltip for datagrid's cells

    I know how to create a tooltip for datagrid and/or its
    columns. Is it possible to create a tooltip (or something similar)
    for each cell? So whenever the mouse is over a certain cell, a tip
    would be shown for that cell that depends on the value of the cell.
    Similar functionality can often be seen in web-based database apps:
    an Ajax query gets related data from a database on mouseOver.
    My need and idea is to
    - show a simple text list as a tooltip
    - the text would be fetched from a database via a web service
    - the fetch would be based on datagrid's (hidden) rowid and
    each column's (hidden) column id (which are real database columns)
    - the database structure is an n:m relation i.e. one
    rowid+colid can refer to several items that are then used in the
    tooltip
    Use case: A number is displayed in the datagrid. The need is
    to display 0-n references related to that specific figure (e.g.
    book names, notes etc) in the tooltip. Next cell's tooltip would be
    showing different references.
    Anybody any ideas or suggestions? Thanks!

    Hi,
    Did you try creating a custom itemRenderer and handling the
    mouse events for that item renderer component. There is also a
    property called dataTipFunction, please check that too.
    Hope this helps.

  • Server Side Page Buffering

    I have the following page flow that I would like to mimic:
    1: User enters criteria on a page, search or otherwise
    2: Page is submitted (server starts rendering a page that takes a long time)
    3: The user is redirect to a page w/ an AJAX query that poll's the server to see if the page is rendered, if not wait, repeat
    4: Page is fully rendered in a server side buffer, the next AJAX poll from the client redirects the client to the rendered page
    This is very akin to Orbitz/Travelocity/Expedia which show you while your flight information is searched for.
    The page that is rendered deals with millions of records and can not be sped up using SQL tuning (any more than is) and the functionality/logic the query performs is as slim as can be. Assume materialized views and region caching are not options due to business rules, data constraints, and data volatility.
    From what I understand of OWA_UTIL, HTP, and APEX this is not possible. I am hoping, beyond hope, that someone has the solution.

    Meta tag only works for refreshing the client page; to make sure the server sends a refresh - put whatever needs refreshing (in my case a table from a database) into a prerender() method that gets invoked each time just before the page is rendered :)

  • Button openinig a new page

    I need a button opening a new window in my application. This window is a page of the application based on a table.
    None knows if it is possible ?

    Hi!
    All is possible :P
    you can easily to that with a process
    select page into :PX_PAGE_TO from table where id = v_id;
    and then your branch can take you to that page, and only execute if that item is not null ;)
    or by ajax, query the page, and with js open the new window

  • JSP returning XML

    Hi ,
    I am trying to generate a xml as a response to the AJAX query by UI. The code does not work. Can anyone please help.? This is my JSP:
    Note: The one thing I noted was if I remove the content type(The code renders the string). But similar thing does not work on IE7.
    <%
    response.setContentType("text/xml");
    String nVal = request.getParameter("nVal");
    String enable=request.getParameter("check");
    StringBuffer sb = new StringBuffer();
    //Generate XML Response
    sb.append("<?xml version="1.0" encoding="utf-8" ?>");
    sb.append(" <DimQueryResults>");
    sb.append("<Dimension displayName="BY TOPIC">");
    sb.append("<DimValue displayName="Accounting" NValue="4294966629" enable="1 " count="60" /> ");
    sb.append("<DimValue displayName="Audit & Attest" NValue="4294966607" enable="1" count="70" /> ");
    sb.append("<DimValue displayName="Business Valuation and Litigation Services" NValue="4294966569" enable="1" count="80" /> ");
    sb.append("<DimValue displayName="Career/Personal Development" NValue="4294966562" enable="1" count="100" /> ");
    sb.append("<DimValue displayName="Consulting Services" NValue="4294966561" enable="1" count="10" />");
    sb.append("<DimValue displayName="Ethics" NValue="4294967247" enable="1" count="10" /> ");
    sb.append("<DimValue displayName="Financial Management" NValue="4294966560" enable="1" count="10" /> ");
    sb.append("<DimValue displayName="Fraud Detection and Prevention" NValue="4294966543" enable="1" count="10" /> ");
    sb.append("<DimValue displayName="Internal Controls" NValue="4294966542" enable="1" count="10" /> ");
    sb.append("</Dimension>");
    sb.append("<Dimension displayName="BY CPE CREDIT">");
    sb.append(" <DimValue displayName="6 - 10 CPE" NValue="4294966629" enable="1" count="60" /> ");
    sb.append("<DimValue displayName="16 - 20 CPE" NValue="4294966607" enable="1" count="70" /> ");
    sb.append(" <DimValue displayName="1 - 5 CPE" NValue="4294966569" enable="1" count="80" /> ");
    sb.append("<DimValue displayName="11 - 15 CPE" NValue="4294966562" enable="1" count="100" /> ");
    sb.append("<DimValue displayName="21 - 25 CPE" NValue="4294966561" enable="1" count="10" /> ");
    sb.append("</Dimension>");
    sb.append("<Dimension displayName="BY FORMAT">");
    sb.append("<DimValue displayName="DVD/Manual" NValue="4294967141" enable="1" count="60" /> ");
    sb.append("<DimValue displayName="Webcast" NValue="4294965697" enable="1" count="70" /> ");
    sb.append("<DimValue displayName="CD-ROM" NValue="4294967163" enable="1" count="80" /> ");
    sb.append("<DimValue displayName="Online" NValue="4294967116" enable="1" count="100" />");
    sb.append("<DimValue displayName="Conference" NValue="4294964809" enable="1" count="10" /> ");
    sb.append("<DimValue displayName="Text" NValue="4294967170" enable="1" count="10" />");
    sb.append("</Dimension>");
    sb.append("</DimQueryResults>");
    sb.append("</xml>");
    out.println(sb.toString());
    %>

    What doesn't work about it?
    Does it throw an exception?
    Does it raise a javascript error?
    Does it make your coffee too strong?
    My first response is
    - Scriptlet code belongs in a Servlet, not a JSP
    - ALl the scriptlet code is doing is out.println anyway - why do you not just have the XML as template text in your JSP?
    At a guess, the extra carriage returns added to the response by JSP will be screwing with your response xml. Carriage returns at the start of it in particular.
    Either
    - Put it in a servlet
    - use JSP properly

  • Ajax Autocomplete Tabular does not work using apex_item.text in SQL Query.

    Hello,
    Is it possible to use the search function which is used in, Dennis Kubicek example, ENAME topic Ajax Autocomplete Tabular
    in a sql query using apex_items?
    Query line :
    , apex_item.text(17,xp.part_nr,null,null,'onfocus="f_register(this);" autocomplete="off"') PART
    At first I followed the example by adding 'onfocus="f_register(this);" autocomplete="off" in the element attributes in the report field.
    This didn't work... so tried to add the it in the attirbutes parameter of the apex_item.
    But this still doesn't work. No errors are given, it does not respond.
    Could somebody please help me?
    Thx!
    Astrid

    Well, I'm trying to take this one step further, but I seem to be having some difficulty.
    I'm trying to make a Filter screen to create a dynamic where clause filter screen.
    This is a page I made with Popup LOVS, just to show you my goal (now trying to use autofilters)
    http://apex.oracle.com/pls/otn/f?p=29989:5
    I have a table on my system that tells you where the field is, and I'm using that to get the table (didn't want to change the javascript, so I pass in a static value).
    This is the javascript code I used
    <pre>
    <script language="JavaScript" type="text/javascript">
    function f_register(p_this,p_name)
    var p_registered = $x('P5_ITEM_ID').value;
         var p_this_name = $x(p_this).id;
    //alert(p_this_name);
    if (p_registered != p_this_name)
    register(p_this_name, "COSTING_M", p_name, "blue", "red");
    $x('P5_ITEM_ID').value = p_this_name;
    </script>
    </pre>
    This is my query
    <pre>
    select column_name || apex_item.hidden(1,column_name) Col_name,
    apex_item.SELECT_LIST_FROM_lov(2,'=','OPERATOR') OPERATOR,
    apex_item.text (3,
    NULL,
    20,
    200,
    'onfocus="f_register(this,''' || column_name || ''');" autocomplete="off"',
    'f3_' || '#ROWNUM#',
    NULL
    ) value,column_id
    from user_tab_cols
    where table_name = 'COSTING_M'
    ORDER BY ROWNUM
    </pre>
    and here is my on-demand process
    <pre>
    declare
    TYPE CurTyp IS REF CURSOR;
    v_row varchar2(4000);
    rec CurTyp;
    V_TABLENAME NKW.UTFIELD_M.TABLE_NAME%TYPE;
    begin
    BEGIN
    SELECT TABLENAME INTO V_TABLENAME
    FROM NKW.UTFIELD_M
    WHERE FIELD_NAME = :TF_SL_COLUMN;
    EXCEPTION WHEN NO_DATA_FOUND THEN RETURN; END;
    :TF_SL_SEARCH := replace(:TF_SL_SEARCH, '&amp;','&');
    :TF_SL_SEARCH := replace(:TF_SL_SEARCH, '&lt;','<');
    :TF_SL_SEARCH := replace(:TF_SL_SEARCH, '&gt;','>');
    :TF_SL_SEARCH := replace(:TF_SL_SEARCH, '&quot;','"');
    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('<rowset>');
    open rec for
    'select distinct ' || :TF_SL_COLUMN || ' ' ||
    'from NKW.' || V_TABLE_NAME || ' ' ||
    'where '||:TF_SL_COLUMN||' like :1||''%'' ' ||
    'and rownum < 100 ' ||
    'order by '||:TF_SL_COLUMN
    using :TF_SL_SEARCH;
    loop
    fetch rec into v_row;
    exit when rec%NOTFOUND;
    htp.prn('<row>' || htf.escape_sc(v_row) || '</row>');
    end loop;
    htp.prn('</rowset>');
    end;
    </PRE>
    I made some slight mods to make the table dynamic from my source table (this is to grab master files when they exist and not to when they don't).
    I get my select list, but it's blank on all fields, any suggestions?
    thanks,
    Scott

  • Getting started with Ajax - how do I query the db without 'submitting' the page?

    Hi guys,
    I'm building a simple 'power point presentation' - basically a cf page which will display a large jpg [a slide]) every n seconds I want the page to query the db to ask if it needs to change the jpg and if so which jpg should it now show. In this way we can control the presentation by updating the database on the fly.
    So I think I will acheive this as follows:
    1. a 'display' page that contains javascript that fires every n seconds
    2. that js to somehow pass 2 variables (GET?) to an action page (ie user id and an authentication var)
    3. the action page will the query the db (using the vars passed in step 2)
    4. the action page returns a result (path to jpg to display) which somehow(?!) is passed back to the display page
    5. the display page then swaps the jpg it is showing for the one passed back to it in step 4
    6. ideally the display page then also passes another 2 variables to the action page letting us know it has received the update and changed the image accordingly
    I'm fine with all the html and cfm stuff - where I am stuck is the js bits, I've had a good look through google and don't seem to be making any progress so if anyone could please point me in the right direction I'd be ever so grateful.
    Any snippets / advice very gratefully received
    TIA
    Nick

    Hi Nick -
    Let me also recommend jQuery.
    Fantastic stuff once you get the hang of it, and even the simple stuff is cool.
    Ok... here's what I did...
    There are probably better ways to do it, but I cheated, in that I did it my way, and got some good results.
    Using divs to define my display areas here's what I did:
    I have 2 select statements -
    1) Selecting from 1 populates the other select.
    2) The JS function is triggered when a selection is made.
    3) The Ajax statement goes out to a web page, that new page does a query and creates a new div with the same name as "txtResult", for my example.
    4) The Ajax then pulls back the new page and displays it.
    It's pretty easy after a few tries.
    Hope this helps.
    Doug
    function dynamic_Select(poolID){
    $.ajax({
    type: "GET",
    url: '/forms/selectSchedules.cfm',
    data: "id=" + poolID,
    dataType: "text/html",
    success: function(html){
        $("#txtResult").html(html);    
        <div style=" padding-left:100px;">   
            Select Pool:
            <select name="pool" onchange="dynamic_Select(this.value)" />
            <option value="#" selected="selected">-Select-</option>
            <cfoutput query="pools">
            <option value="#poolID#">#poolName#</option>
            </cfoutput>
            </select>
            <span id="txtResult" style=" padding-left:100px;">
                Select Schedule:
                <select name="schedules" id="schedules" onchange="getInfo()">
                <option></option>
                </select>
            </span>
        </div>

  • Ajax and JSTL Query possible?

    Hi all ! I want to know if this is possible and if you have an example you could show. So far Im trying like this:
    function ajaxFunction(){
         alert("ajaxFunction");
         var ajaxRequest;  // The variable that makes Ajax possible!
         try{
              // Opera 8.0+, Firefox, Safari
              ajaxRequest = new XMLHttpRequest();
         } catch (e){
              // Internet Explorer Browsers
              try{
                   ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
              } catch (e) {
                   try{
                        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                   } catch (e){
                        // Something went wrong
                        alert("Your browser broke!");
                        return false;
         // Create a function that will receive data sent from the server
         ajaxRequest.onreadystatechange = function(){
              if(ajaxRequest.readyState == 4){     
              appendOptionLast(ajaxRequest.responseText);
         //var age = document.getElementById('age').value;
         //var wpm = document.getElementById('wpm').value;
         //var sex = document.getElementById('sex').value;
         //var queryString = "?age=" + age + "&wpm=" + wpm + "&sex=" + sex;
         //alert("Antes open");
         ajaxRequest.open("GET", "/TWC/Comun/Ajax.jsp", true);
         //alert("Despues open");
         ajaxRequest.send(null);
    }And here is my JSP thats doing the query.
    <%@page contentType="text/html"%>
    <%@ page import="beans.*,java.util.*" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix=”sql” %>
    <%@page pageEncoding="ISO-8859-1"%>
    <sql:setDataSource dataSource=”jdbc/TWC” />
    <sql:query var=”qryItems” >
        SELECT User_ID
        FROM product
        ORDER BY nombre
    </sql:query>
    <c:forEach var=”row” items=”${qryItems.rows}”>
         User: <c:out value=”${row.User_ID}” /><br> 
    </c:forEach>Thanks!

    thanks guys but I finally got it to work with JSTL and ajax.
    The only "weird" thing is that when I parse the data to my JSP I get a bunch of white spaces at the end of each value for each field. Here is my code:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
    <sql:setDataSource dataSource="jdbc/TWCApp" />
    <sql:query var="producto">
    select ITEMDESC AS name,IV00101.ITEMNMBR AS Number,USCATVLS_2 AS category,USCATVLS_1 AS Brand,
    USCATVLS_3 AS Type,CURRCOST AS Invoice_price,
    QTYONHND AS Stock_number, IV00102.LOCNCODE AS Location
    from TWC.dbo.IV00101 JOIN TWC.dbo.IV00102 ON IV00101.ITEMNMBR=IV00102.ITEMNMBR
    WHERE IV00101.ITEMNMBR = '${param.product}' AND IV00102.LOCNCODE = '${param.location}'
    </sql:query>
    <c:forEach items="${producto.rows}" var="row">
    ${row.name},${row.number},${row.category},${row.brand},${row.type},${row.Invoice_price},${row.Stock_number},${row.Location}
    </c:forEach>Here is my JS:
    ajaxRequest.onreadystatechange = function(){
              if(ajaxRequest.readyState == 4){     
              appendOptionLast(ajaxRequest.responseText);
    function appendOptionLast(valor)
      //alert(valor);
      //var elOptNew = document.createElement('option');
      var elSel = document.getElementById('category_producto');
      var mySplitResult = valor.split(",");
      document.form1.nombre_producto.value=mySplitResult[0];
      document.form1.numero_producto.value=mySplitResult[1];
      document.form1.category_producto.value=mySplitResult[2];
      document.form1.brand_producto.value=mySplitResult[3];
      document.form1.type_producto.value=mySplitResult[4];
      document.form1.invoice_producto.value=mySplitResult[5];
      document.form1.stocknumber_producto.value=mySplitResult[6];
      if(mySplitResult[6]>0){
      document.form1.stock_producto.value="Available"
      else{document.form1.stock_producto.value="Out of stock"
      document.form1.location_producto.value=mySplitResult[7];So how I can get rid of all those extra spaces at the end of each value?
    thanks!
    Edited by: juanmanuelsanchez on Apr 2, 2010 11:29 PM
    Edited by: juanmanuelsanchez on Apr 2, 2010 11:32 PM

  • Carl's / Scott's Ajax Tree Example Query

    Hi,
    Hoping someone can assist, I have utilized Carl's and Scott's Ajax tree example, specifically have used the following example from Carl's app, i.e.:
    http://apex.oracle.com/pls/otn/f?p=11933:49:4073287192617448::NO:RP::
    All is working great but my query is, with the following query, that I am using, i.e.
    SELECT "EMP"."MGR" as "MGR",
            "EMP"."EMPNO" as "EMPNO",
            "EMP"."ENAME" as "ENAME" ,
            (select count(*)  from "EMP" "EMP2" where  "EMP2"."MGR" = "EMP"."EMPNO") BranchCount
    from
    "EMP" "EMP"
    where
    "EMP"."MGR"  =  :BRANCH_IDI need to also retrieve the LEVEL pseudo-column as well for each record retrieved as I need the LEVEL info for trying to determine at what level of the tree I am at.
    I believe you can only use the LEVEL column with a CONNECT BY PRIOR clause.
    I would actually like to incorporate the LEVEL column into the above query - is this possible?
    If not, can someone pls assist with re-writing the above query using a connect by clause which will still retrieve the same info as Carl's original query.
    Thanks.
    Tony.

    Hello,
    Sure just replace the body section of the procedure with something like this.
    for c1 in (
    select emp_no,emp_name,emp_manager
    from emps
    order by 2 asc;
         )loop
    htp.prn ('&lt;div>' || c1.emp_no || '-' || c1.emp_name || '-' || c1.emp_manager||'&lt;/div>');
    end loop;
    Carl

Maybe you are looking for

  • Adobe Acrobat 9 Pro re install on new PC...Which serial number is right one?

    I have acrobat 9 Download version 2010 on two PC's. Two separate serial numbers. I have stopped using one of these PC's and want to download and re install the software on a new PC. I don't know how to tell which serial number version is on which PC?

  • Problem with Interaction Centre-Webclient

    Hai Experts, The problem in this issue is call HR center people when they end call the calls does not end itself and they are not able to receive any calls unless they close manually and reopen the session and We are not able to reproduce this issue

  • Removing "Unknown Album" from Cover Flow

    Is it possible to remove any albums that don't have names (but are named "Unknown Album" on the iPod) from Cover Flow, but still keep those songs on your iPod? The "Unknown Album" art clutters Cover Flow...I don't mind it in Now Playing but in Cover

  • Host Named Site Collections and www

    I currently have a hostnamed webapp that uses Windows Auth(Claims) in the default zone and it is extended for anonymous access(Internet Zone) I have siteinternal.com and www.sitexternal.com The users also want to use siteexternal.com without the www.

  • IPhoto crashes computer..loss of data

    Shut down and restart your computer, and then open iPhoto again. If the problem persists, try rebuilding your photo library. To do this, quit iPhoto, and then reopen it while keeping the Option and Command keys pressed. You can also try restoring you