Skip to main content
Inspiring
October 28, 2008
Question

A little help with ajax cfdiv tag

  • October 28, 2008
  • 1 reply
  • 3167 views
Hi, i am displaying my categories records in atable, and against each category i have an edit link.

i am trying like that if i click the edit link [It is not a button]. the page should gets loaded with a textbox and category name already filled and then i click submit to submit the form.

I am using the code as below:

<cfoutput query="showcategories">
<tr>
<td>#trim(category)#</td>
<td><a href="##" onClick="?catID=#catID#">Edit</a></td>
</tr>
</cfoutput>
<cfif isdefined('url.catID')>
<cfdiv bind="url:divsource.cfm?catID={catID}" ID="theDiv" style="background-color:##CCffFF; color:red; height:350"/>
</cfif>

mydivsource page contains this:

<cfdump var="#url#">
<cfinvoke component="cfc.product" method="categories" chkcatID="#URL.catID#" returnvariable="getCatID"/>
<cfform name="categoryByID">
<cfinput type="text" name="categoryname" value="#getCatID.category#" tooltip="The Category Name" tabindex="1">
<cfinput type="hidden" name="catID" value="#getCatID.catID#">
<cfinput type="button" name="button2" value="Edit Category">
</cfform>

when i try to run, i get the error as like below:

syntax error
[Break on this error] ?catID=3

can anyone guide me in this? plz i m very new to ajax stuff in cf.
This topic has been closed for replies.

1 reply

Inspiring
October 28, 2008
onClick event expects a javascript function. what you have there should
be in the HREF attribute.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Inspiring
October 29, 2008
Well that does not seems to work either.

Here is the code what i tried?

But It Generates and Error, When i click the edit link, the following eror is prompted.

Bind Failed, Element Not Found catID

the following dump is generated.

struct
CATID [empty string]
_CF_CLIENTID A874C1300D4469CFC73B80E70B13CF70
_CF_CONTAINERID thecategory
_CF_NOCACHE true
_CF_NODEBUG true

Ok now i do not know why it is not picking up the catID definedin the url and the link.