I have several errors that I could use some help on. Below is just one of them. I mention that in case I need to bring them all up in order to troubleshoot this correctly. Maybe it is worth noting that I am going through the learncfinaweek.com hands on (ORM) and have most of the code working except the categories that keep the boxes checked in editBlogPost.cfm and Categories are not saving correctly. That said, here is the first error:
The cfdump showed that title is getting pulled in, so I would like to know why it won't pass the var.
Element TITLE is undefined in BLOGPOST
The error occurred in C:/ColdFusion11/cfusion/wwwroot/learncfinaweek/chapter1solution/admin/content/blog/listblo gpost.cfm: line 34 |
listBlogPost.cfm:
<cfimport taglib="../../customTags" prefix="ct" />
<ct:securityCheck redirectPage="#cgi.script_name#"/>
<cfset adminPath = createObject('learncfinaweek.chapter1solution.admin.cfc.system').getBasePath(cgi.script_n ame) />
<!--- Pull Blog Posts --->
<cfset blogPosts = EntityLoad('BlogPost') />
<cfoutput>
<ct:layout section="blog">
<ct:navigation section="blog" active="post"/>
<div class="span10">
<h2>Blog</h2>
<form class="navbar-form pull-right">
<a class="btn btn-primary" href="<cfoutput>#adminPath#</cfoutput>/content/blog/editblogpost.cfm">
<i class="icon-plus icon-white"></i>
New Blog Post
</a>
</form>
<table class="table table-hover">
<thead>
<tr>
<th>Title</th>
<th>Publish Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<cfloop array="#blogPosts#" index="blogPost">
<tr>
<td>
<!--- Title --->
#blogPost.title#
</td>
<td>
<!--- Date Posted --->
#dateFormat(blogPost.datePosted,"mm/dd/yyyy")#
</td>
<td>
<!--- Edit Post --->
<a href="#adminPath#/content/blog/editblogpost.cfm?id=#blogPost.id#"><i class="icon-edit"></i></a>
</td>
</tr>
</cfloop>
</tbody>
</table>
</div>
</ct:layout>
</cfoutput>
blogPost.cfc:
component persistent="true" {
Property name="id" column="blogpostid" fieldtype="id" generator="increment";
Property name="title" ormtype="text";
Property name="summary" ormtype="text";
Property name="body" ormtype="text";
Property name="dateposted" ormtype="timestamp";
Property name="createdDateTime" ormtype="timestamp";
Property name="modifiedDateTime" ormtype="timestamp";
Property name="deleted" ormtype="boolean";
Property name="comments" singularname="comment" fieldtype="one-to-many" cfc="blogComment" fkcolumn="blogpostid" cascade="all";
Property name="categories" fieldtype="one-to-many" cfc="blogPostCategory" fkcolumn="blogPostid";
public string function getCategoryIDs() {
var categoryList = '';
if ( hasCategories() ) {
for (var categoryPost in getCategories() ) {
categoryList = listAppend( categoryList, categoryPost.blogCategory.id);
}
}
return categoryList;
}
public string function getCategoryNames(){
var categoryList = '';
if(hasCategories()){
for(var categoryPost in getCategories()){
categoryList = listAppend(categoryList, categoryPost.blogCategory.name,', ');
}
}
return categoryList;
}
}