Category and dropdown on draft content

I’ve noticed that if you have a field that is a category (ftRenderType=dropdown) and that content object has draft version, eg

<cfproperty name="catAge" type="longchar" required="no" default="" 
  ftSeq="100" ftFieldset="Additional Publishing Options" ftLabel="Age
  ftType="category" ftAlias="ages" ftRenderType="dropdown" 
  ftSelectMultiple="false" />

When editing it tries to pull it’s selected categories from the refCategories table using

<cfset lSelectedCategoryID = oCategory.getCategories(objectid=arguments.stObject.ObjectID,bReturnCategoryIDs=true,alias=arguments.stMetadata.ftAlias) />

in category.cfc

It will always fail because the refCategories only get updated when the objects if published. So if you go to edit the draft it will loose it’s category on the dropdown and default to the default (unless you reselect before save).
We should change it to using arguments.stMetadata.value like the ‘jquery’ render uses.

If no one has an objection I’ll do a pull request.


1 Like

Thanks Phil, go ahead.