0

I am using EE Core and have set-up a site so that when a new entry is published, you also select a category for it, and on the front end this simply outputs the category name. This works perfectly when you publish an entry from the back end, but I also have a safecracker form and when you post a new entry from that, the category name doesn't get outputted - but the drop down of categories is there and correct. Any ideas what could be causing this?

This is is outputting the name;

<h1>{categories}{category_name} {/categories}</h1>

And the safecracker form with just the category code;

{exp:safecracker channel="new_property" return="property/property-index" }
   <select name="my_custom_field">
{exp:channel:categories style="linear"}   
<option value="{category_name}">{category_name}</option>
{/exp:channel:categories} 
</select>
 {custom_fields}    
{/exp:safecracker}

1 Answer 1

1

Are you using "Category Field" (http://devot-ee.com/add-ons/category-field) as custom field or storing category with any other field type.

You should just save the categories and that category field automatically populate category name like:

{exp:safecracker channel="new_property" return="property/property-index" }
   <select name="category[]">
{exp:channel:categories style="linear"}   
<option value="{category_id}">{category_name}</option>
{/exp:channel:categories} 
</select>
 {custom_fields}    
{/exp:safecracker}

You can try above code. I hope, it would work for you.

3
  • FYI Category Field fieldtype doesn't actually store any data. Categories are stored in native format. It simply alters the publish form and category selection mechanism. Commented May 18, 2013 at 21:22
  • Yes, I know that. I would like to suggest here just to select a category for the entry and category field will show that selected category. Commented May 19, 2013 at 1:01
  • I am glad to see your input here as you are developer of this useful add-on. Commented May 19, 2013 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.