I think you guys are making this waaaaay too complicated. Take a look at this:
<cfparam name="FORM.allow_refresh" type="numeric" default="0" /> <cfparam name="FORM.submitted" type="numeric" default="0" /> <cfparam name="FORM.name" type="string" default="" /> <!--- BEGIN: PRE-PAGE PROCESSING. ---> <!--- Check to see if form has been submitted. If it has, make sure that we are not refreshing. ---> <cfif (FORM.submitted AND (NOT FORM.allow_refresh))> <!--- Process form data... store in DB. ---> <cfelseif NOT FORM.allow_refresh> <!--- Initialize form data (first run of page). ---> <cfset FORM.name = "Ben Nadel" /> <cfelse> <!--- DO ROW ADD STUFF HERE. ---> </cfif> <!--- END: PRE-PAGE PROCESSING. ---> <script type="text/javascript"> function AddRow( ..... ){ var objForm = document.forms[ 0 ]; // CODE TO ADD ROW GOES HERE ... whatever that may be // Tell form to refresh. objForm.elements[ "allow_refresh" ].value = 1; // Refresh form. objForm.submit(); } </script> <form> <input type="hidden" name="submitted" value="1" /> <input type="hidden" name="allow_refresh" value="0" /> <input type="text" name="name" value="#FORM.name#" /> <input type="submit" value="Submit" /> </form> As you can see, we are storing all of our form data IN the form scope. And, we only intialize the FORM data on the first hit of the page (when we have neither submitted nor done a page refresh). Then, when ever you add a row (what ever that may do), all we do is submit the form and allow the page to refresh. Since we are setting the FORM.allow_refresh hidden form field, the data is NOT processed NOR is the form re-initialized... It simply refreshes and shows what ever data was submitted from the previous page. As part of the PRE-page processing, there is an ELSE statement that ONLY fires if you are doing a refresh... Do what ever you need to do here and then just continue letting the page load. ...................... Ben Nadel Certified Advanced ColdFusion Developer www.bennadel.com -----Original Message----- From: Dave Jones [mailto:[EMAIL PROTECTED] Sent: Friday, October 13, 2006 12:59 PM To: CF-Talk Subject: Re: Form Fields - storing unsaved values. Andrew, I had a similar situation. The way I did it is a) set up the parent form to pull the field values from session vars (I use a home-grown formBean); b) when the popup window is called, first use Ajax to pass the parent's field values to a routine on the server which stores then into session variables; then c) when popup window is submitted, update the session vars, reload the parent window (which of course uses the updated session vars), and close the popup. Works fine, except for an irritating "Reload" box IE insists on popping up. Dave Jones NetEffect At 01:49 PM 10/12/2006, you wrote: >Got a form with a list of rows coming from a database. User enteres >new data, then realizes he needs to add a row to this form. User click >sa hyperlink to do just that - and a popup window opens for him to add >a row. User closes the popup window after successful addition, and >form must refresh to add the row, but a refresh would erase the unsaved data. >What is an elegant way to store this data and repopulate the refreshed >window with it? I could prompt the user to save the form before leaving >it if the form is dirty, and I do, but the form has many edits and >would never successfully submit to the dbif the user had to add a row >and a value to that row. So I need to store it another way > > I am guessing some javascript would help. Somehow I may be able to >loop through the form's fields and capture each value and pass it along >to the popup window, then back down to the main window after the refresh. >Does that sound like a good start? Something like: > >for(var i=0; i < window.document.form1.elements.length; i++{ > putInArray(window.document.form1.elements[i].value); >} > >I know that syntax is no where close to what it should be, but am I on >the right track? Thanks. > >Sincerely, > > > >Andrew > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256719 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4