Element TITLE is undefined in BLOGPOST

Explorer ,
Dec 05, 2015 Dec 05, 2015

Copy link to clipboard

Copied

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/listblogpost.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_name) />

<!--- 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;

  }

}

TOPICS
Getting started

Views

652

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Dec 06, 2015 Dec 06, 2015
To get the value of the property X of an entity, use myEntity.getX() instead of myEntity.X. That is,blogPost.getTitle() instead of blogPost.title

Likes

Translate

Translate
Adobe Community Professional ,
Dec 06, 2015 Dec 06, 2015

Copy link to clipboard

Copied

To get the value of the property X of an entity, use myEntity.getX() instead of myEntity.X. That is,

blogPost.getTitle() instead of blogPost.title

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 07, 2015 Dec 07, 2015

Copy link to clipboard

Copied

Thank You.  That displayed the data Title for me.  Some of the categories are empty and some of them are named the same name.  Is that the reason why it is giving an error?  I guess I should get the category section fully working and try to delete them from there maybe?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 07, 2015 Dec 07, 2015

Copy link to clipboard

Copied

DavidSCarlisle55 wrote:

That displayed the data Title for me.

OK. So we have solved that one.

DavidSCarlisle55 wrote:

Some of the categories are empty and some of them are named the same name.  Is that the reason why it is giving an error?  I guess I should get the category section fully working and try to delete them from there maybe?

The original error was about the title. As you say, the title is now displayed. Is the current error about categories?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 07, 2015 Dec 07, 2015

Copy link to clipboard

Copied

Yes, thank you.  that solved the issue with the #blogpost.title# error.  The #blogpost.getTitle()# showed me that there was several empty titles, so then I went into mySQL command line and deleted the empty ones with a couple queries.  Then I reloaded the #blogpost.title# without the get function and now it works great.  Thank you.

When I am ready to get the other errors solved I will post them on here in a different question.  Thanks again.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 07, 2015 Dec 07, 2015

Copy link to clipboard

Copied

LATEST

Also cfdump displayed the empty data but the get function seems a little simpler.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines