How do you get a cfwindow to update a query on the origin page

I can't seem to get my head around this problem. I've got an accounting app where I want to add a new bill and if I type in a vendor who is not yet in the database I want to pop up a window to record the new vendor information, then return to the add bill page and continue with the information i've entered so far. I've tried cfwindows, but they don't seem to actually submit to the database, and even so, when I return to the origin page all typed data is cleared. Even a pointer towards a solution would be great. Sorry if the problem is spelled out well.

Why do it with a pop-up, when you can do it without? You could do it as follows.
Make, for example, Vendor name an autosuggest input field. When the user types, Coldfusion fetches the matching name from the database, if any exists. The bind attributes ensure that Coldfusion will automatically fill in the ID that corresponds to a matching name, and eventually the product that corresponds to the vendor name and ID.
If no such match exists, then you know the vendor is new. In that case, the application will add the new vendor. You may also choose to update, for example, the name or product of a vendor.
addNewVendor.cfm 
================= 
<cfif isDefined("form.vendor_name")> 
<!--- Assmumes Vendor.cfc is in the current directory ---> 
<cfset vendorObject = createobject("component","Vendor")> 
<cfset vendorObject.updateVendor(form.vendor_name, form.vendor_id, form.vendor_prod)> 
</cfif> 
<cfform>
Vendor name: <cfinput type="text" name="vendor_name" autosuggest="cfc:Vendor.getName({cfautosuggestvalue})"><br><br>
Vendor ID: <cfinput type="text" name="vendor_id" bind="cfc:Vendor.getId({vendor_name})"><br><br>
Vendor product: <cfinput type="text" name="vendor_prod" bind="cfc:Vendor.getProduct({vendor_name},{vendor_id})"><br><br>
<cfinput name="sbmt" type="submit" value="Add or update vendor">
</cfform> 
Vendor.cfc
==========
<cfcomponent output="false">
    <cffunction name="getName" access="remote" returntype="array" output="false">
        <cfargument name="suggestvalue" required="true">
        <cfset var local = structNew()>
        <!--- The function returns suggestions as an array. --->
        <cfset local.vendorArray = ArrayNew(1)>
        <!--- Get all unique last names that match the characters the user types. --->
        <cfquery name="local.getVendorName" datasource="myDSN">
        SELECT DISTINCT vendorName FROM Vendor
        WHERE vendorName LIKE <cfqueryparam value="#suggestvalue#%"
            cfsqltype="cf_sql_varchar">
        </cfquery>
        <!--- Convert the query to an array. --->
        <cfloop query="local.getVendorName">
            <cfset arrayAppend(local.vendorArray, vendorName)>
        </cfloop>
        <cfreturn local.vendorArray>
    </cffunction>
    <cffunction name="getId" access="remote" returntype="array" output="false">
        <cfargument name="vendorName" required="true">
        <cfset var local = structNew()> 
        <cfset local.idArray = ArrayNew(1)>
        <cfquery name="local.getVendorId" datasource="myDSN">
        <!--- Get ID that matches vendor name --->
        SELECT id FROM Vendor
        WHERE vendorName = <cfqueryparam value="#arguments.vendorName#"
            cfsqltype="cf_sql_varchar">
        </cfquery>
        <cfloop query="local.getVendorId">
            <cfset arrayAppend(local.idArray, id)>
        </cfloop>
        <cfreturn local.idArray>
    </cffunction>
    <cffunction name="getProduct" access="remote" returntype="array" output="false">
        <cfargument name="name" required="true">
        <cfargument name="id" required="true">
        <cfset var local = structNew()>
        <cfset local.prodArray = ArrayNew(1)>
        <cfquery name="local.getProd" datasource="myDSN">
        <!--- Get product that matched vendor name and id --->
        SELECT product FROM Vendor
        WHERE vendorName = <cfqueryparam value="#arguments.name#"
            cfsqltype="cf_sql_varchar">
        AND id = <cfqueryparam value="#arguments.id#"
            cfsqltype="cf_sql_varchar">
        </cfquery>
        <cfloop query="local.getProd">
            <cfset arrayAppend(local.prodArray, product)>
        </cfloop>
        <cfreturn local.prodArray>
    </cffunction> 
    <cffunction name="updateVendor" access="public" returntype="void" output="false">
        <cfargument name="name" required="true">
        <cfargument name="id" required="true">
        <cfargument name="product" required="true">
        <cfset var local = structNew()>
        <!--- I have assumed vendor ID is unique --->
        <cfquery name="local.verifyVendor" datasource="myDSN">
        SELECT count(*) as noOfVendors
        FROM Vendor
        WHERE id = <cfqueryparam value="#arguments.id#"
            cfsqltype="cf_sql_varchar">
        </cfquery>
        <!--- If vendor exists in table, update; else insert--->
        <cfif local.verifyVendor.recordCount GT 0>       
            <cfquery name="local.updateVendor" datasource="myDSN">
            UPDATE Vendor
            SET product =  <cfqueryparam value="#arguments.product#" cfsqltype="cf_sql_varchar">,
            vendorName = <cfqueryparam value="#arguments.name#" cfsqltype="cf_sql_varchar">
            WHERE id =    <cfqueryparam value="#arguments.id#" cfsqltype="cf_sql_varchar">             
            </cfquery>
        <cfelse>
            <cfquery name="local.saveVendor" datasource="myDSN">
            INSERT INTO Vendor(vendorName,id,product)
            VALUES(<cfqueryparam value="#arguments.name#" cfsqltype="cf_sql_varchar">,
                   <cfqueryparam value="#arguments.id#" cfsqltype="cf_sql_varchar">,
                   <cfqueryparam value="#arguments.product#" cfsqltype="cf_sql_varchar">)
            </cfquery>
        </cfif>
    </cffunction>
</cfcomponent>

Similar Messages

  • How do you get your music on your phone without syncing the whole iTunes library on your phone?

    How do you get your music on your phone without syncing the whole iTunes library on your phone?

    Are you syncing to a different computer?  Iphone will sycn with only one at a time.  Syncing to another will erase the current content.
    Otherwise, just select what you want to be on the iphone under the music tab and sync.  What do you care if it erases?  You will be syncing what you want to the iphone.

  • HT204053 How do you get your last batch of down loads to the new computer if the old one crashed before i was able to get it on my ipod

    How do you get your last batch of down loads to the new computer if the old one crashed before i was able to get it on my ipod

    See Here  >  Download Past Purchases
    http://support.apple.com/kb/HT2519

  • How do you get a word and character count of a document in Pages for Mavericks

    How do you get a word and character count of a document in Pages for Mavericks?

    Hi jonathan,
    I struggled with this one as well, as i'm finishing up a PhD thesis and word counts are incredibly important. Through trial and error i found out that words like 'e.g.' and 'i.e.' count as two words and an ampersand (&) doesn't count at all. That being said, i didn't like the fact that the word count always included footnotes and i was dismayed that i couldn't get an accurate count of words in the main body of my text. That all disappeared yesterday when, by chance, while i was copying a completed chapter and pasting it into my main document, i discovered that Pages can indeed give you an accurate word count excluding the footnotes!  Here's all you need to do:
    1. In pages 5.2, make sure that the Word Count function is first enabled by selecting View --> Show Word Count from the Pages Menu Bar. (If it's already enabled, it will read View --> Hide Word Count, so if that's what it says, then no need to do anything.)
    2. Once enabled, check the Word count that's currently showing at the bottom of the page. That's the word count including your footnotes.
    2. Now, place your cursor anywhere within the current document, then hit command+A (for Select All).
    3. Viola! Your word count now shows the actual number of words within the body of the text only, excluding footnotes!
    Hope that helps!

  • How do you get time machine to reset your computer to the specific date you would like?

    How do you get time machine to reset your computer to the specific date you would like?

    Hey carlleeh,
    Thanks for the question. The following resource may guide you through that process:
    OS X Mountain Lion: Recover your entire system
    http://support.apple.com/kb/PH11192
    Thanks,
    Matt M.

  • HT1473 When downloading a CD album, if it contains different artists, the album is split up into separate albums/icons. How do I get all songs into one album (just like the original CD)?

    When downloading a CD album, if it contains different artists, the album is split up into separate albums/icons. How do I get all songs into one album (just like the original CD)?

    Generally, in iTunes, all you need to do is fill in an appropriate Album Artist to keep things together. For older iPods each track from the same album should have the same artist, or be marked as a compilation where appropriate. For iOS devices you may need to go to Settings > Music > Group By Album Artist > On.
    For more details see my article on Grouping Tracks Into Albums, in particular the topic One album, too many covers.
    tt2

  • How do you get your text messages to not show on the screen when they come in

    How do you get your text messages to show on the screen when then come in?  My iphone 3s would just say the persons name and text message.  This says the persons name and the whole message

    Settings > Notifications > Messages > Show Preview - Turn to OFF

  • How do you get an app to update that seems to be frozen?

    On my iphone4 my boyfriend selected to update all of my apps at once which happend to be quite a few so i paused a few of the updates to later go back and update one at a time. I forgot to go back until about 2 days later and I now cannot get my apps to update.... I went back in to the app store and selected update all and they just seem to be frozen not updating. before I did this i would try to unpause them and a message came up that they were unable to update at this time then below was the option to be done or to retry so i selected retry and the message came up again. how can I fix this?

    Sign Out of your Account... Settings > Store > Apple ID
    Close All Open Apps...  Perform a Reset... Try again...
    Reset
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430
    iPhone User Guide

  • How do you get notified of Gmail archived labels that skip the inbox with the mail app on iOS devices?

    If you are fimiliar with Gmail you know that you are able to set up labels/filters. Well i have my filters set up so when a certain person/company emails me the email gets archived into a certain folder and skips the inbox. This works great for me. This orgnazation method to keep an amazing clean/empty inbox works great. It's just like having a Filing cabinant and inside the filing cabinant you have a folder(label) for each file(email). Below is a sample Gmail that has Archived Labels that have content in each Archived Label that as you can see.. skip the inbox completely regeardless if the message was read or not.
    If the Archived Label has a new message in it it will have (1) next to it.
    Ex.
    Client One Folder (23)
    Client Two Folder
    Client Three (2)
    Client Four (5)
    Understand how that works? It works great for orginaziaonl reasons..
    Here is a photo of what it really looks like. (Info Blurred for security reasons)
    On the Gmail end of things this works great if you ask me...only flaw to this is my iOS device won't notify me that i have a new email in my ClientArchived Folder due to the fact that the Mail app preinstalled on the device only checks the inbox for new mail and does NOT check for new mail sent to Archived folders where majority of my mail is set up for orginazional reasons.
    I am aware that if i am using my iOS device that i can go to the Mail App and scroll down to account > Gmail > Scroll down and my archived folders for each client are their & shows how many emails are from each client..
    but why doesn't it notifty me about this emails that get sent to these organized archived folders in notifcation center?
    See the Mail App icon below? Well above it says i have 16 unread emails throughout my Gmail folders/labels.. Why doesn't it give me a red bubble via NC(noticication Center) on the app saying i have 16 unread messages?
    My problem isn't that i can't get the emails on the phone.. it's just if i am not expecting an email and someone emails me.. i won't get it until i go and pysically check in the mail account > gmail > archived folder. It's very frustrating seeing as if i like to be quick to respond to emails. Well it's hard to be quick to respond if my phone doesn't notify me about the emails.
    Why won't the App notify me when i have emails in folders other than "Inbox"?
    Called Apple and talked to a Technician.. He was clueless of a solution.
    Does anyone have a fix for this or a work around?
    Any help/input is apperciated!
    -Thanks

    my problem exactly. Did you ever figure it out? I had to resort to turning off labels in the web interface for Gmail. Not ideal

  • How do you get new tabs on firefox to open to your home page?

    When I open new tabs in firefox they open to the blank "new tab" pg. How do i get them to open directly to my homepage on igoogle that opens when I start firefox?

    You can do that by using an add-on such as [https://addons.mozilla.org/firefox/addon/2221/ NewTabURL] or [https://addons.mozilla.org/firefox/addon/777/ New Tab Homepage].

  • How can I get my iPod to update when it says the server cannot be connected?

    Whenever I try to update my iPod it says, "The iPod software update server could not be contacted. Make sure your network settings are correct and your network connection is active, or try again later." It does this every time. How can I get it to update? Any help is much appreciated, thanks!

    Update Server
    Try:
    - Powering off and then back on your router.
    - iTunes for Windows: iTunes cannot contact the iPhone, iPad, or iPod software update server
    - Change the DNS to either Google's or Open DNS servers
    Public DNS — Google Developers
    OpenDNS IP Addresses
    - For one user uninstalling/reinstalling iTunes resolved the problem
    - Try on another computer/network
    - Wait if it is an Apple problem

  • How do you get a playlist of music to work on the basic Photo App which comes with ipad 2 - to have to play the same tune over and over again with a slideshow is rubbish !

    How does one get a varity of music i.e a playlist to work on the standard Photo App which is shipped with Ipad 2  when using a slideshow ?

    if you have music in your library, when  tapping on slideshow a menu appears - Turn on music option.  when on a song should display below it - tapping it will take you to your library.
    Photo App will give you access to all albums as set in settings\Photo
    Camera - select camera roll - gives camera roll only but options for everything else
    Slideshow timings is under Settings\Photo

  • How do you get tomcat 5.5. to compile JSPs in the Sun JDK

    Tomcat 5.5 JSPs do not compile with Java 5 code therefore how do you change it to use the Sun's JDK to compile Java 5 code.
    It does seem odd that you can compile Java 5 servlets but not JSP's.

    I've followed all these steps, but my Tomcat/5.5.4 still won't compile my 1.5-java-syntaxed JSP's.
    Here is exception stack:
    org.apache.jasper.JasperException: Unable to compile class for JSP
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:342)
         org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:248)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
         org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:62)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         apollinary.filter.EncodingFilter.doFilter(EncodingFilter.java:19)
    root cause
    Error running javac.exe compiler
         org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:473)
         org.apache.tools.ant.taskdefs.compilers.JavacExternal.execute(JavacExternal.java:47)
         org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:931)
         org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
         org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:213)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
         org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:62)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         apollinary.filter.EncodingFilter.doFilter(EncodingFilter.java:19)I tried to substitute /common/lib/jasper-compiler-jdt.jar with Tomcat/5.0.27's /common/lib/ant.jar or IDEA 5.0's /lib/ant/ant.jar - effects are the same as described above.
    What's the problem?

  • How do you get to use an animated finger instead of the cursor?

    Hello. I've seen in a screenshot video that a developer was showing how his app works by using an animated finger instead of the regular arrow (cursor). Does anybody know what's the name of that finger program/app?
    Thanks!

    Actually, i just found it. It's called PhoneFinger: wonderwarp.com/phonefinger/

  • How do I get rid of"Index of file:///C:/" as the opening page?

    Every time Mozilla is opened, the following file is displayed: Index of file:///C:/ How can I get rid of it and set up a different homepage?

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    Do a malware check with some malware scanning programs on the Windows computer.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of their databases before doing a scan.<br /><br />
    *http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    *http://www.superantispyware.com/ - SuperAntispyware
    *http://www.microsoft.com/security/scanner/en-us/default.aspx Microsoft Safety Scanner
    *http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    *http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    *http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

Maybe you are looking for