Remember to also var you function variables too, your cfquery in the
function is not var'ed that will cause problems later.

On 5/2/07, Anne Porosoff <[EMAIL PROTECTED]> wrote:
>
> Ok, turns out I'm an idiot.  I did some more digging around and apparently
> the problem was originating from another CFC that I was calling from the
> first CFC.  Once I corrected that problem, everything worked
> great.  Nonetheless, thanks for looking into this one for me.
>
> --Anne
>
> > Not a problem, let me know if the below helps:
> ------------>
> ---------------------------------------------------------------------
> > form.cfm:
> ------------>
> ---------------------------------------------------------------------
> > <cfset vPageID = 1>
> >
> > <script language="javascript">
>
> > function addNewItem(){
>
> > var curobj = document.myForm;
>
> > var queryString = "?pageID="#vPageID#" +
>
> > "&itemName=" + curobj.itemName.value;
>
> >
>
> > window.frames['itemfrm'].location = 'add_new_item.cfm' + queryString;
>
> > }
> > </script>
> >
> > <iframe style="width:0;height:0;margin:0;padding:0;display:none;"
> > id="itemfrm" name="itemfrm" src=""></iframe>
> >
> > <form name="myForm" action="form.cfm">
>
> > Add Item: <input type="text" name="itemName" />
>
> > <input type="button" value="Add New Item" onclick="addNewItem()" />
> > </form>
> >
> ------------>
> ---------------------------------------------------------------------
> > add_new_item.cfm
> ------------>
> ---------------------------------------------------------------------
> > <cfset itemData = createObject('component','itemDataMethods').
> > init(pageID = url.pageID)>
> >
> > <cfoutput>
>
> > #itemData.addToItems(itemName = url.itemName)#
> > </cfoutput>
> >
> ------------>
> ---------------------------------------------------------------------
> > itemDataMethods.cfc
> ------------>
> ---------------------------------------------------------------------
> > <cfcomponent>
>
> > <cffunction name="init">
>
> > <cfargument name="pageID" required="true">
> >
>
> > <cfscript>
>
> > variables.pageID = arguments.pageID;
>
> > </cfscript>
> >
>
> > <cfreturn this>
>
> > </cffunction>
> >
>
> > <cffunction name="addToItems"
>
> > access="public"
>
> > returntype="void">
>
> > <cfargument name="itemName" required="true">
> >
>
> > <cfquery name="addItem" datasource="myItemsDB">
>
> > insert into myItemsTable
>
> > ( pageID,
>
> > itemName
>
> > )
>
> > values ( <cfqueryparam value="#variables.pageID#"
> > cfsqltype="CF_SQL_VARCHAR">,
>
> > <cfqueryparam value="#arguments.itemName#"
> > cfsqltype="CF_SQL_VARCHAR">
>
> > )
>
> > </cfquery>
>
> > </cffunction>
> > </cfcomponent>
> ---------------->
> ---------------------------------------------------------------------
> >
> > This is a very basic overview of the scripts I'm working with and
> > hopefully it gives you a better idea of what I'm working with.
> > However, if you have any questions, please let me know.  Thanks in
> > advance for your help.
> >
> > --Anne
> >
> > >Anne,
> > >I don't know of any specific problems with the technique that you
> > are
> > >trying to use.  I would suggest trying to make a really simple demo
> > of
> > >what you are trying to achieve for demonstration purposes, and post
> > that
> > >code to the list so we can see all the moving parts of what is going
> > on,
> > >then we might be able to give you some more feedback.
> > >
> > >Rich
> Kroll
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276754
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