Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
For a more sophisticated application like you describe, you have got to have a clear idea of what happens on the Client, what happens on the server and how information gets from one to the other.
The <cfwindow...> is just a handy wizard to make DHTML and|or AJAX based <div> on the client. These submit data to a server just as any other action on the page would. With a request. That request could affect the entire page with links or forms, or they could be contained inside of frames that only affect that part of the User Interface, or the requests could be made behind the scenes with JavaScirpt XMLHttpRequest() funciton calls.
No matter how the request is made, the server is going to return a response. That response would then be directed to the root browser, frame or response handler defined in the JavaScript function call. That response can then be used to update the HTML. How much the browser will do this for you and how much you will have to program yourself depends on what type of response you are working with.
From here it is up to you on how you want to put all these various pieces together. You can have the 'window' do all the work, you can pass the data from the 'window' to the parent to do the work. You can have the window submit the data AND update the parent without bothering with a response from the server. There are practically infinite possibilities here.
Copy link to clipboard
Copied
Thanks ilssac, for the very thoughtful reply. I'm working my way through it, slowly but surely. I really appreciate your help.
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
Thanks, BKBK, I think this is the correct approach for my specific issue. Thanks so much for your help.