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
 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:256753
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to