the Photos variable isn't persistent (not a session, cookie, application or whatever variable) so it's being redefined as 0 by the cfparam with every request to the page. My suggestion (quick and dirty) would be to put it in a hidden form field or pass it in the url. /t
>-----Original Message----- >From: Rick Faircloth [mailto:[EMAIL PROTECTED] >Sent: Monday, April 04, 2005 7:07 PM >To: CF-Talk >Subject: RE: Anything wrong with this statement? > >> What happens if it is passed in with a non-numeric value ... > > Wouldn't happen...the variable is used only on a page which > is submitting back to itself. No other pages are utilizing it. > Its default is set to 0, the formula runs, adding 1 to the value, > and then it gets incremented up 1 if the "Add Another Photo" > button is clicked... > > Trying to work out a CF solution to allowing a user to add more > CFFILE fields to a page when they click a button. > > When the page is submitted back to itself, the variable is upped 1, > and a CFLOOP is run creating the amount of CFFILE fields > specified by the variable, "Photos". > > Seems simple...but so far it's not working. I'm just missing > something at this point... > > Rick > > > >-----Original Message----- >From: Aaron Rouse [mailto:[EMAIL PROTECTED] >Sent: Monday, April 04, 2005 12:48 PM >To: CF-Talk >Subject: Re: Anything wrong with this statement? > > >I'd think "importance" would be subjective as to who was looking at >it. I personally try to always do it like this: > ><cfset Photos = Variables.Photos + 1 /> > >But I got into the habbit of putting in Variables due to working with >inherited code that lacks much of any scoping. So I'd maybe come >across a page with references to Photos but have no idea if they were >expecting it to come in via the URL, FORM, or whatever. In some >really rare cases they might have had: > ><cfparam name="Photos" default="0" /> > >But I'd still not have any idea where they were expecting it to come >from with that. > >All your CFPARAM is doing before the set is making Photos if it did >not already exist and setting it to 0. What happens if it is passed >in with a non-numeric value ... > >On Apr 4, 2005 11:43 AM, Rick Faircloth ><[EMAIL PROTECTED]> wrote: > >> >> As to scoping it with variables., as in "variables.photos", why >> is that important? >> > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:201396 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54