Strange thing is that i only use getdata for the related arrays, so
that shouldn't create any extra record.
But it must be the presence of those array fields in the ft:object
that indeed trigger some stuff.

On Oct 28, 9:43 pm, Marco van den Oever <[email protected]>
wrote:
> When i don't use bSessionOnly and comment out the custom createdata
> code, i only see one record, so that works.
>
> When i do use  bSessionOnly, leave the custom createdata code active,
> comment out all the array related stuff, then only one record is
> inserted...
>
> Based on that i assume it's array related...
>
> On Oct 28, 9:25 pm, Tomek Kott <[email protected]> wrote:
>
> > you're right, it seems that either bSessionOnly is not working, or something
> > else is going on. I'm trying to remember if for some reason the db saving
> > has to happen twice because of the arrays or something similar.
>
> > Have you tried tracing this through? I don't have any clues for you, sorry.
>
> > On Wed, Oct 28, 2009 at 4:20 PM, Marco van den Oever <
>
> > [email protected]> wrote:
>
> > > OK here it is:
>
> > > <ft:processForm action="Verzenden" exit="true">
>
> > > <ft:processFormObjects typename="emailberichten" bSessionOnly="true" /
>
> > > <!--- if a emailberichten object was succesfully saved --->
> > > <cfif len(lSavedObjectIDs)>
>
> > > <!--- get the emailberichten object data to get other relative data
> > > that needs to be included --->
> > > <cfset stemailberichten = getData(objectid=lSavedObjectIDs) />
>
> > > <!--- get the emailadresverzender emailaddress --->
> > > <cfset obj = createObject
> > > ('component',application.stcoapi.emailaccounts.typePath) />
> > > <cfset emailadresverzender = obj.getdata
> > > (objectid=stemailberichten.aemailaccounts) />
>
> > > <!--- loop over the selected contactpersonen --->
> > > <cfloop index="i" array="#stemailberichten.acontactpersonen#">
>
> > > <!--- set incrementing custom currentrow variable so based on that
> > > value we can set or don't set some other variables --->
> > > <cfparam name="currentrow" default="0">
> > > <cfset currentrow = currentrow + 1>
>
> > > <!--- get current contactpersonen item based on current
> > > acontactpersonen loop array item --->
> > > <cfset obj = createObject
> > > ('component',application.stcoapi.contactpersonen.typePath) />
> > > <cfset contactpersoon = obj.getdata(objectid=i) />
>
> > > <!--- set default emailadresontvangerlist variable value to use if one
> > > emailadresontvanger exists, or as default variable to further build a
> > > loop building list, only set this variable when currentrow is 1 as it
> > > is only used when there is only one emailadresontvanger --->
> > > <cfif currentrow eq "1">
> > > <cfset emailadresontvangerlist = contactpersoon.emailadres>
> > > </cfif>
>
> > > <!--- if there are more then one emailadresontvangers, add them to
> > > list, only set this variable when currentrow is not 1 as it is only
> > > used when there are more then one emailadresontvangers, also when used
> > > in currentrow 1 it would duplicate the previous set
> > > emailadresontvangerlist variable --->
> > > <cfif arraylen(stemailberichten.acontactpersonen) gte 2 and currentrow
> > > neq "1">
> > > <cfset emailadresontvangerlist = emailadresontvangerlist & "," &
> > > contactpersoon.emailadres>
> > > </cfif>
>
> > > </cfloop>
>
> > > <!--- write email to db --->
> > > <cfset obj = createObject
> > > ('component',application.stcoapi.emailberichten.typePath) />
> > > <cfset stprops = {} />
> > > <cfset stprops.emailadresontvanger = emailadresontvangerlist />
> > > <cfset stprops.emailadresverzender = emailadresverzender.emailadres />
> > > <cfset stprops.emailonderwerp = stemailberichten.emailonderwerp />
> > > <cfset stprops.emailtekst = stemailberichten.emailtekst />
> > > <cfset stprops.label = stemailberichten.emailonderwerp />
> > > <cfset obj.createData(stProperties=stprops) />
>
> > > <!--- set message id for cfmail --->
> > > <cfset messageid = listlast(stobj.emailadresontvanger,"@")>
> > > <cfset messageid = createuuid() & "@" & messageid>
>
> > > <!--- send the email --->
> > > <cfmail type="html"
> > > from="#emailadresverzender.emailadres#"
> > > to="#emailadresontvangerlist#"
> > > subject="#stemailberichten.emailonderwerp# -
> > > ###stemailberichten.objectid#">
> > >        #stemailberichten.emailonderwerp# -
> > > ###stemailberichten.objectid#
> > >                <br />
> > >        <br />
> > >        #replace(stemailberichten.emailtekst,Chr(13),"<br>", "all")
> > > #<br />
> > >        <br />
> > >        <br />
> > >        Vriendelijke groeten,
> > >                <br />
> > >                <br />
> > >                #session.dmprofile.firstname# #session.dmprofile.lastname#.
> > >                <br />
> > >        <br />
> > >        http://#cgi.http_host#<br />
>
> > > <!--- if a file is submitted in the email --->
> > > <cfif arraylen(stemailberichten.aemailbestanden)>
>
> > > <!--- loop over the selected emailbestanden --->
> > > <cfloop index="i" array="#stemailberichten.aemailbestanden#">
>
> > > <!--- get current dmfile item based on current aemailbestanden loop
> > > array item --->
> > > <cfset obj = createObject
> > > ('component',application.stcoapi.dmfile.typePath) />
> > > <cfset emailbestand = obj.getdata(objectid=i) />
>
> > > <!--- set file path --->
> > > <cfset file = "http://www."; & listlast
> > > (emailadresverzender.emailadres,"@") & "/
> > > files#emailbestand.filename#">
>
> > > <!--- set cfmailparam with current loop file --->
> > > <cfmailparam file="#file#">
> > > </cfloop>
>
> > > </cfif>
>
> > > <!--- if a image is submitted in the email --->
> > > <cfif arraylen(stemailberichten.aemailafbeeldingen)>
>
> > > <!--- loop over the selected emailafbeeldingen --->
> > > <cfloop index="i" array="#stemailberichten.aemailafbeeldingen#">
>
> > > <!--- get current dmimage item based on current aemailafbeeldingen
> > > loop array item --->
> > > <cfset obj = createObject
> > > ('component',application.stcoapi.dmimage.typePath) />
> > > <cfset emailafbeelding = obj.getdata(objectid=i) />
>
> > > <!--- set image path --->
> > > <cfset file = "http://www."; & listlast
> > > (emailadresverzender.emailadres,"@") & emailafbeelding.sourceimage>
>
> > > <!--- set cfmailparam with current loop file --->
> > > <cfmailparam file="#file#">
> > > </cfloop>
>
> > > </cfif>
>
> > > <cfmailparam name="Message-Id" value="<#messageid#>">
> > > <cfmailparam name="Reply-To" value="#emailadresverzender.emailadres#">
> > > <cfmailparam name="MIME-Version" value="1.0">
>
> > > </cfmail>
>
> > > </cfif>
>
> > > </ft:processForm>
>
> > > On Oct 28, 9:04 pm, Tomek Kott <[email protected]> wrote:
> > > > it would probably help if you gave the entire "processForm" tag code,
> > > unless
> > > > the code you gave is the only thing in there.
>
> > > > On Wed, Oct 28, 2009 at 2:54 PM, Marco van den Oever <
>
> > > > [email protected]> wrote:
>
> > > > > OK, i have a custom type that uses bSessionOnly="true" so i can set
> > > > > the properties.
> > > > > In the type i can use 2 array related fields, dmfile and dmimage.
>
> > > > > I have only one obj.createData in the "processForm" and the
> > > > > processForm action name is unique to others on the same page...
>
> > > > > Still, when i execute the code i get two db inserts, one is using the
> > > > > properties like i stated in my custom code:
>
> > > > > <!--- write email to db --->
> > > > > <cfset obj = createObject
> > > > > ('component',application.stcoapi.emailberichten.typePath) />
> > > > > <cfset stprops = {} />
> > > > > <cfset stprops.emailadresontvanger = emailadresontvangerlist />
> > > > > <cfset stprops.emailadresverzender = emailadresverzender.emailadres />
> > > > > <cfset stprops.emailonderwerp = stemailberichten.emailonderwerp />
> > > > > <cfset stprops.emailtekst = stemailberichten.emailtekst />
> > > > > <cfset stprops.label = stemailberichten.emailonderwerp />
> > > > > <cfset obj.createData(stProperties=stprops) />
>
> > > > > The other record inserts like it should when you don't use a
> > > > > bSessionOnly="true".
>
> > > > > Any insights, is it because there are related arrays involved???
>
> > > > > Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: [email protected]
To unsubscribe, email: [email protected]
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---

Reply via email to