Is it possible to return a database query without refreshing the page?

I have a form which has a drop-down select box. What I want to do is send the value from the select list to a CFC which runs some SQL code and returns a recordset. I then want to use this recordset on my original CFM page that has the form on it.
Is it possible to do this without refreshing the page through some kind of AJAX? Apologies I am a newbie at AJAX but I did manage to write a bit of code that uses <cfdiv> to bind to a URL that does the database work and returns some HTML. But really I just want the database recordset and not sure how to get it?

You could use AJAX, Flex Remoting or any such remoting technique. That is, if there is a case for it. However, from what you describe in the first paragraph, you don't need to. Just send the form to its own page.
In the following example, the CFC and CFM page are both in the same directory under the root. I have made use of the cfdocexamples datasource which ships with ColdFusion.
Employee.cfc
<cfcomponent>
<cffunction name="getEmployeeDetails"  output="false" returntype="query">
<cfargument name="employee_id">
<cfset var employeeDetails = queryNew("","")>
<cfset var emp_id = arguments.employee_id>
<cfif isNumeric(emp_id)>
    <cfquery name = "employeeDetails" dataSource = "cfdocexamples">
        SELECT firstname, email as email_name, department, phone, location
        FROM Employees
        WHERE emp_id = <cfqueryparam cfsqltype="cf_sql_integer" value="#emp_id#">
    </cfquery>
</cfif>
<!--- Will activate error-handler in the caller --->
<cfif NOT isNumeric(emp_id) or employeeDetails.recordcount EQ 0>
    <cfthrow message="You selected no employee.">
</cfif>
<cfreturn employeeDetails>
</cffunction>
</cfcomponent>
testPage.cfm
<cfif isDefined("form.employee_id")>
    <cfset employeeObj = createobject("component","Employee")>
    <!--- employeeDetails is a query--->
    <cfset employeeDetails = employeeObj.getEmployeeDetails(form.employee_id)>
    <cfdump var="#employeeDetails#">
</cfif>
<cfform action="#CGI.SCRIPT_NAME#">
<cfselect name="employee_id">
<option value="0">Employee</option>
<option value="1">Carolynn Petersen</option>
<option value="2">Dave Heartside</option>
<option value="3">Linda Stewart</option>
</cfselect>
<cfinput name="sbmt" type="submit" value="Send">
</cfform>

Similar Messages

  • Random display of database products without refreshing

    Hi all,
    How can I make a list of products randomly change on the
    page, without refreshing and using flash?
    Or is it possible with flash?
    I can create the query but need to know how to make it
    randomly change on the page without refreshing the page.

    Why do you not want a refresh?
    "Julian Roberts" <[email protected]> wrote in message
    news:f7svkq$2mc$[email protected]..
    > You could look at using Ajax, not an easy prospect
    though.
    >
    > --
    > Jules
    >
    http://www.charon.co.uk/charoncart
    > Charon Cart 3
    > Shopping Cart Extension for Dreamweaver MX/MX 2004
    >
    >
    > "The_FedEx_Guy" <[email protected]>
    wrote in message
    > news:f7srj1$rmr$[email protected]..
    >> Hi all,
    >> How can I make a list of products randomly change on
    the page, without
    >> refreshing and using flash?
    >>
    >> Or is it possible with flash?
    >>
    >> I can create the query but need to know how to make
    it randomly change on
    >> the
    >> page without refreshing the page.
    >>
    >
    >

  • I want single update query without use the function.

    I want to update sells_table selling_code field with max date product_code from product table.
    In product table there is multiple product_code date wise.
    I have been done it with below quey with the use of function but can we do it in only one update query
    without use the function.
    UPDATE sells_table
    SET selling_code = MAXDATEPRODUCT(ctd_vpk_product_code)
    WHERE NVL(update_product_flag,0) = 0 ;
    CREATE OR REPLACE FUNCTION HVL.maxdateproduct (p_product IN VARCHAR2) RETURN NUMBER
    IS
    max_date_product VARCHAR2 (100);
    BEGIN
    BEGIN
    SELECT NVL (TRIM (product_code), 0)
    INTO max_date_product
    FROM (SELECT product_code, xref_end_dt
    FROM product
    WHERE TO_NUMBER (p_product) = pr.item_id
    ORDER BY xref_end_dt DESC)
    WHERE ROWNUM = 1; -- It will return only one row - max date product code
    EXCEPTION
    WHEN OTHERS
    THEN
    RETURN 0;
    END;
    RETURN max_date_product;
    END maxdateproduct;
    Thanks in Advance.

    Hi,
    Something like this.
    update setlls_table st
            set selling_code =(select nvl(trim(product_code)) from 
                                  (select product_code
                                          , rank() over (partition by item_id order by xref_end_dt DESC) rn
                                       from product
                                   ) pr
                                   where rn =1
                                         and pr.item_id = st.ctd_vpk_product_code
                               ) where NVL(update_product_flag,0) = 0 ;As such not tested due to lack of input sample.
    Regards
    Anurag Tibrewal.

  • On Sympatico homepage, my local weather and news does not come up unless I refresh the page. But when I return to the homepage during the same session, local news/weather is gone again. Is this correctable?

    When I first open the browser and it goes my homepage, Sympatico.ca, there are 2 areas of the homepage you can personalize. On the left hand side "News" Column, the bottom box "Local News" allows you to select a location (Toronto, Ontario Canada for me) to display news from that area. On the far right hand column, below the advertising bar, is "Weather" where you select your city (Brantford in my case) and it will display the 4 day forecast in C or F degrees. Once you close the homepage the settings are saved. The problem is that when I leave the homepage to any other website, if I return to the homepage the weather and local news is back to the default setting of having to select the city again. I did find if I just refreshed the page, the personalized settings appear. I have Firefox 4 and it seemed to correct the problem when I installed 4 as the same problem had been occurring with my previous version of Firefox. But now it's back to having to refresh the page to get the saved location for local weather and news. My wife uses IE8 on the same PC and has not had this problem on her Sympatico homepage.

    aha!
    Wed Feb 14 12:29:16 2007
    PUSH:
    Received control message:
    'PUSH_REPLY,
    route 192.168.100.3 255.255.255.255,
    route 192.168.1.0 255.255.255.0,
    route 192.168.3.0 255.255.255.0,
    route 172.16.0.0 255.255.0.0,
    route 10.123.123.0 255.255.255.0,
    redirect-gateway,
    dhcp-option DNS 172.16.70.12,
    dhcp-option WINS 172.16.70.2,
    dhcp-option DOMAIN timberline.int,
    route-gateway 172.16.70.254,
    ping 10,ping-restart 120,
    ifconfig 172.16.70.216 255.255.255.0'
    The ifconfig line the server is pushing is not right. That is meant for a point to point connection. That is why the local client is puking on it...it is not correct. At least for a tun type device. If it was a tap, then it would be fine.
    http://openvpn.net/man.html
    (look for "--ifconfig l rn" )
    so.... change the line to dev tap, and then do this stuff..
    http://wiki.archlinux.org/index.php/OpenVPN_Bridge

  • Is it possible to put a watermark on all of the pages of the document?

    is it possible to put a watermark on all of the pages of the document?

    Hi,
    It's not possible within FormsCentral. If you are distributing your form as a PDF, you could use Adobe Acrobat to apply the watermark. When editing a PDF created by FormsCentral, please refer to the following document:
    http://forums.adobe.com/docs/DOC-3661
    Regards,
    Brian

  • When I make a contact sheet on Iphoto is it possible to put a title on top of the page, that is not a title of one of the photos?

    Is it possible to put a title on top of the page in a contact sheet on Iphoto?

    No.  But you can create a text file for TextEdit, Word, Pages or other text application that you use, put a title at the top and print it on the already printed contact sheet.  Just make the top margin in iPhoto's contact layout  large enough so the title can be printed there by the other app.

  • (LR5) Possible to synchronize a modification-amount, without unifying the settings ?

    (LR5) Possible to synchronize a modification-amount, without unifying the settings ?
    Assume I have ten completely different photos i each optimized individually.
    Thus, sliders (not speaking about curves) of, say, color-tint  or temperature; could/would be each on a different setting.
    Is it possible to intervene on such a slider collectively without changing their individual starting-point?
    "Every selected-photo's  tint-slider  go up by 7 values,  without synchronizing the final setting itself ?
    ( first photo slider position of  -7  becomes 0,   second photo was 2 and becomes 9, etc) ?
    Auto-sync does not do that.
    Sync does not.
    Is there a plug-in for enabling this?
    ignoring the solution ?
    Impossible ?
    Thank You for any reply soon ! :-)

    Yes:
    * Without a plugin: limited adjustments are available via Quick Develop section.
    * With plugin: comprehensive support is available via plugins like Gazoo (free), which I wrote.
    Rob

  • Is it possible to trace users sql query disconnected from the session

    One of my users used to run the sql query daily, Now her machine rebooted and she lost all the sql query. is there any way to trap the sql what she used to run? I have the os/sql username....
    thx

    user587112 wrote:
    Yes we are using 10.2.0.3. main requirement of user is all the sql query she used to run.To get this query she is giving me her os user.And says why it is not possible?What would that be possible? If this database is reserved for her only that could be possible.
    Once she lost her session, there's no reliable method to trace all her SQL queries. The SID will be reused by Oracle, her SQL could be flushed out of shared pool, consider Oracle is designed to tackle with thousands of queries per seconds there's no feasible way to save all these information without impact on performance.
    So unless you had sql trace turned on her session or the database is reserved for her use only, then no it's not possible to retrieve all her SQLs and guarantee it. You might be able recover some of SQL from the mentioned DBA views but no guarantee what so ever.
    PS. it's no guarantee to get all her SQLs even her session is still active, unless SQL trace were turned on.
    Edited by: yingkuan on Jan 13, 2009 11:48 AM

  • 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>

  • How to get the database value without submitting the jsp page

    Hi,
    I have a form that has many fields (textbox/listbox). when user enter/change a value in the first textbox, I need to pass this value to the database to check whether it exist and get the other values to be displayed to other fields in that form (i cannot get the javascript value to be pass to jsp without reload/refresh/submit. But, I need to get the user entered value, so I thought of hidden popup, iframe, etc but not sure how I could apply and which best suit this case). If I submit the page then I can easily get the value thru 'request.getParameter("fieldname") but cannot use this because I cannot submit the page.
    Pls help and possible provide me with the sample coding
    Thanks

    The best way for you is surely AJAX. But there is another way to stay compatible with older browsers:
    Since the default method a browser supposed to get data is refresh, there is nothing unnatural in it. Browsers are optimized to refreshes, like cached images, etc..
    So for these step-by-step things, you need to roll forward your data from page to page, and make the page to respond according the data it actually have. This can be easily achived with type="hidden" input fields in a form: the user will send you back all the data. Optionally you may show him the data you already have as visible text too.
    A more generalised way to "pull" the data: you make a whole page you include every time you need an additional data. This page will receive 2 parameters from where you've included it. This 2 parameters are each indexed arrays with the datas you have to pull in (here the default value), and you need to push forward. Optionally there is a 3rd parameter, the url it have to return (as the form's action property).
    And for them who now say that it would me more culture way to store this data in the session: Beware! Common mistake: Sessions are to store data about the user itself, not the datas for the next page! You never know what will be the next page! The user click some backward button and refresh button, and depending on your script, it may go stupid! Ok, not all the codes, but I've seen some. It's ok to store a sent file (fx. image) on the server, but always think the evil refresh and back buttons!

  • Error when executing the query or refreshing the workbook

    Hi All,
    Whenever I am trying to execute a query or refresh a workbook a error message is poping up saying that
    Error: <internal error> Problem when writing table: E_T_cel.
    I face this error in few of the queries and when i refresh workbooks. These queries have lot of calculations and filters and they sum up lot of records.
    Any help greatly appreciated.
    Thanks
    Raj.

    Hi Maik,
    Thanks for reply, I went into tran sm21 but i could not understand the messages there. Below is the list of messages in sm21
                         System Log: Local Analysis of cdsap9d                    1                                                    
    From date/time............. 04/20/2005 / 10:00:00
    To date/time............... 04/21/2005 /        
    User....................... KADALPR    
    Transaction code...........                    
    Terminal...................        
    Task.......................  
    Problem class..............           
    Further restrictions.......                                                                               
    Sorted ? ................ SOFI
    Pages with single entries 00000100
    With statistics............ 
                         System Log: Local Analysis of cdsap9d                    2                                                    
    Time     Ty. Nr Cl. Tcod MNo Text                                                                                Date : 20.04.05 
    12:58:10 DIA  0 100      R49 Communication error, CPIC return code 019, SAP return code 728                                                 
    12:58:10 DIA  0 100      R5A > Conversation ID: 29858195                                                                               
    12:58:10 DIA  0 100      R64 > CPI-C function: CMSEND(SAP)                                                                               
    12:58:10 DIA  0 100      R68 Perform rollback                                                                               
    12:58:10 DIA  0 100      R47 Delete session 001 after error 003                                                                             
    23:54:49 DIA  1 100      R49 Communication error, CPIC return code 019, SAP return code 728                                                 
    23:54:49 DIA  1 100      R5A > Conversation ID: 44959947                                                                               
    23:54:49 DIA  1 100      R64 > CPI-C function: CMSEND(SAP)                                                                               
    System Log: Local Analysis of cdsap9d                    3                                                    
    Time     Ty. Nr Cl. Tcod MNo Text                                                                                Date : 21.04.05 
    09:32:50 DIA  2 100      R49 Communication error, CPIC return code 019, SAP return code 728                                                 
    09:32:50 DIA  2 100      R5A > Conversation ID: 83536783                                                                               
    09:32:50 DIA  2 100      R64 > CPI-C function: CMSEND(SAP)                                                                               
    Reading:  
    Number of records read.........       2777
    Number of records selected.....         11
    Old records skipped............       2733
    Records of invalid users skippe         33
    Further selection:  
    Number of records read.........         11
    Number of records selected.....         11
    Number of records printed......         11
    End of system log
                         System Log: Local Analysis of cdsap9d                    4                                                    
                        C o n t e n t s                              
    Contents              Page              Start            End  
    Selection criteria     1
                           2        20.04.2005  12:58:10 - 23:54:49
                           3        21.04.2005  09:32:50 - 09:32:50
    Contents               4
    End of program  -
    If you can help me out as where to look at these messages then it great.
    Thanks,
    Raj.

  • HT1766 iPhone 4s; Is it possible to sync apps to icloud without using the touchscreen?

    I've been using my iphone 4S with a cracked screen for over three months now (it fell on a tile floor hitting the top front corner first, 5 weeks after I got it) without any issues. Tonight I dropped it from a height of about 8 inches and the part of the face that was cracked made first contact with something that was on a table I was standing at, jamming it further into the phone. When I picked it up I noticed a small piece had also fallen out near an intersection of the cracks. The touchscreen is now completely black.
    My question: Is it possible to sync my apps to the icloud without using the iphone touchscreen? I plan I getting a new phone and had my icloud setup to sync my mail, contacts and calendars. I've been able to download all my pictures and video to my computer.

    Getting/reinstalling the apps isn't a problem. I'm only concerned with the data that is stored within them. For instance I have a mileage tracker I've been using but haven't uploaded the data from the phone to back it up anywhere. I'd like to do that before getting a new phone but I can't see what i'm doing due to the screen not working.
    The phone is actually still working and I've been able to use Siri to make calls and send texts without a working screen. The screen still accepts inputs apparently so if I could return settings to factory settings I could theoretically use another phone side by side to show me exactly where I need to touch and when to back up my applications to iClould.
    Going forward, I actually had ordered another case before my accident as my current case doesn't provide enough protection. It'd be nice if Apple actually made an iphone that didn't need such band-aids for normal usage.

  • BEX - Query Designer - Query Execution - IE "The page cannot be displayed'

    Hi ALL,
    Trying to execute a query from BEx Query Designer, result needs to be displayed on Internet Explorer.
    However, when IE pops up to show the result, it says 'The page cannot be displayed'.
    It seems the PORT Number is wrong.
    When I execute the RSPLAN the port number is 52300 (23 ASCS)  (and it works!!).
    For this web query the port in URL is 55300 (53 SCS).
    Could you help to configure the right port?
    Something needs to be done on Basis side configurations?
    Thank you,
    Nivia

    Hi,
    This especific problem was solved na SM30 programa RSPOR_T_PORTAL.
    But I still have problem:
    The PORTAL logon is displayed and after input the user and pass shows the 500 Internal Error.
    Caused by: com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to message server host failed
    Connect_PM  TYPE=B MSHOST=calsaps011.net.bradesco.com.br GROUP=PUBLIC R3NAME=BWH MSSERV=sapmsBWH PCS=1
    ERROR       partner 'calsaps011.net.bradesco.com.br:sapmsBWH' not reached
    I have looked the services and hosts and the files has the sapgw<> and sapms<> right configured.
    The important detail is that The PORTAL works if it doesn't come from BEx.
    COULD SOMEONE HELP ME?
    Tks,
    Nivia

  • Displaying carriage returns from database query

    hi i'm fairly new to colfusion but have a good basic
    understanding.
    i'm trying to build a community website that has a guestbook
    and forums. i want to build these from scratch.
    i'm using cfmx7 and sqlserver 2005.
    the problem i'm having is when my cfm page retrieves posts
    made to the guestbook or forum, the carriage return characters are
    missing. posts are coming out all on one line.
    how do i get the retrieved posts to display new lines and
    paragraphs the way they were input into the database?
    just like these forums do?
    thanx so much. adella.

    Here is the code. Just replace body with your db field name.
    <cfoutput>
    #Replace(body, newLine, "<br>", "ALL")#
    </cfoutput>

  • Is it possible to run a java program without using the command prompt?

    Hi,
    I was wondering whether it is possible to run a Java program (not an applet) without using a command line in the command prompt?
    Basically I want to run a program that will be continually running in the background and hence I don't want to have a command prompt screen loaded up as well - I just want the program to be running in the task bar.
    I know how to run the program in the task bar - but I still need to launch the program from the command prompt - is there anyway I can get a program running without having to start it from the command prompt?
    Cheers

    Or create a desktop shortcut (in Windows) or an application launcher ( in Linux GUI).

Maybe you are looking for

  • DSL Line Disconnections

    Hey guys, new poster here. Recently my interent connection has been playing up somewhat, it's perfectly fine during the day but once it hits about 4 o'clock in the afternoon it periodically disconnects regularly in intervals of 2-15 minutes. I've che

  • Excise register rg1

    hi, i m modifying rg1 . in this register i have to convert quantity into no. using this formula.    qty = menge * ( umren / umrez). ( umren & umrez in table MARM) when i do this it give me run time error PACKED FIELD CONTAIN INCORRECT BCD FORMAT can

  • ITunes 7.7 Won't Install/Error message

    Every time I attempt to upgrade I get this error message after the download finishes: "Errors occurred when installing the updates. If there problem persists update manually" So is there a way to fix this or how do I upgrade manually?

  • PR delivery

    Dear All PP Experts, I am having one more dought regarding MRP as below. PR raised for items required to manufacture has delivery dates after the planned order date .e.g. Planned order date 05.11.2008 requires X material for production   on 05.11.200

  • Click button to 'show' strange behaviour

    I have a slide with 3 click boxes which when clicked 'show' text captions that are set to be invisible on slide load.  For some reason when a click box is clicked it shows the associated text caption (great) but then sometimes it automatically contin