Category being removed with SAEF / Form Helper
Posted: 01 April 2008 10:44 AM   [ Ignore ]
Newbie
Rank
Total Posts:  15
Joined  2007-09-15

Hey Mitchell-

I have an SAEF edit form with form helper.

The form is working fine, but for the edit form, using your recommended hidden fields, the category is not getting populated even when the original post has a category assigned.

{exp:weblog:entries weblog="companies" disable="category_fields|member_data|pagination|trackbacks" rdf="off" author_id="CURRENT_USER" limit="1" category="9"}

     {if no_results}  
      
<!-- Show the entry form -->
      
       
{Company Profile Entry}
     
       {exp
:weblog:entry_form weblog="companies" return="account" use_live_url="no" category="9"}

... fields removed for length...

       
{/exp:weblog:entry_form}
     
     
     {
/if} <!-- no_entries -->
     
     
      <!--
show the edit form -->
      
      
{Company Profile Edit}
      
      {exp
:weblog:entry_form weblog="companies" return="account" use_live_url="no"}
       
<input type="hidden" name="entry_id" value="{entry_id}" />
       <
input type="hidden" name="title" value="{title}" />
       <
input type="hidden" name="entry_date" value="{entry_date format='%Y-%m-%d %g:%i %A'}" />
       <
input type="hidden" name="category[]" value="{cat_id}" />
            
...
fields removed for length...

      
{/exp:weblog:entry_form}
     
    
    {
/exp:weblog:entries}

Again, everything populates except for the category- view source is below:

<form id='entryform' method="post" action="http://mysite.com/account/company/"  >
<
div class='hiddenFields'>
<
input type="hidden" name="ACT" value="18" />
<
input type="hidden" name="RET" value="http://mysite.com/account/company/" />
<
input type="hidden" name="PRV" value="" />
<
input type="hidden" name="URI" value="/account/company/" />
<
input type="hidden" name="XID" value="8288a27c371a2e77a7d48aced8e38f535b4eaef1" />
<
input type="hidden" name="return_url" value="account" />
<
input type="hidden" name="author_id" value="2" />
<
input type="hidden" name="weblog_id" value="4" />
<
input type="hidden" name="site_id" value="1" />

</
div>


<
input type="hidden" name="entry_id" value="11" />
<
input type="hidden" name="title" value="Web Inception" />
<
input type="hidden" name="entry_date" value="2008-03-26 10:52 PM" />
<
input type="hidden" name="category[]" value="{cat_id}" />

Any ideas?  Thanks- Chad

Profile
 
 
Posted: 01 April 2008 10:53 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3343
Joined  2006-10-18

Chad,

You’ll need to wrap the {categories} variable pair around your code smile

{categories}<input type="hidden" name="category[]" value="{category_id}" />{/categories}

 Signature 
Profile
 
 
Posted: 01 April 2008 11:31 AM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  15
Joined  2007-09-15

OK that worked. 

The < input type="hidden" name="category[]" value="{cat_id}" / > in step 6 of your plugin instructions is a bit misleading.  If you instead showed the line you recommended above I think it would have been much clearer.  Just my .02.

TTYL thanks

Profile
 
 
Posted: 01 April 2008 11:35 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3343
Joined  2006-10-18

Yeah, you’re right… I’ll slap Mitchell for that one LOL

 Signature 
Profile
 
 
Posted: 13 November 2008 07:12 AM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  6
Joined  2006-07-17

I wonder if someone can give me a hand here as well. I have an edit form manually populated with the values from the category because they don’t seem to come in automatically. But the real problem is that when I come to the edit page, the dropdown field doesn’t show the category selected for the entry. It always lands on “A” which isn’t correct. Here’s my code. Help.

<p><label for="category">Category</label>
<
select name="category[]">
{exp:form_helper:categories entry_id="{entry_id}" parent_id="2"}
<option value="{cat_id}" {selected}>{cat_name}</option>
{/exp:form_helper:categories}
<option value="A">A</option>
<
option value="B">B</option>
<
option value="C">C</option>
<
option value="D">D</option>
<
option value="E">E</option>
<
option value="F">F</option>
<
option value="G">G</option>
<
option value="H">H</option>
<
option value="I">I</option>
<
option value="J">J</option>
<
option value="K">K</option>
<
option value="L">L</option>
<
option value="M">M</option>
<
option value="N">N</option>
<
option value="O">O</option>
<
option value="P">P</option>
<
option value="Q">Q</option>
<
option value="R">R</option>
<
option value="S">S</option>
<
option value="T">T</option>
<
option value="U">U</option>
<
option value="V">V</option>
<
option value="W">W</option>
<
option value="X">X</option>
<
option value="Y">Y</option>
<
option value="Z">Z</option>
</
select>
{categories}<input type="hidden" name="category[]" value="{cat_id}" />{/categories}
</p>

Profile
 
 
Posted: 13 November 2008 07:55 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3343
Joined  2006-10-18

So this code does not work for you? smile

<select name="category[]">
{exp:form_helper:categories entry_id="{entry_id}"}
<option value="{cat_id}" {selected}>{cat_name}</option>
{/exp:form_helper:categories}
</select>

 Signature 
Profile
 
 
Posted: 14 November 2008 09:22 AM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  6
Joined  2006-07-17

What in the world?! I thought I had copied that same code out of the example php file verbatim. Apparently not, because this time it worked like a charm. Thanks Pie Man!

Profile
 
 
Posted: 14 November 2008 09:31 AM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3343
Joined  2006-10-18

msteinruck,

Haha… well, there’s a good chance that file is out of date, as it’s probably 1 or 2 years old rasberry

 Signature 
Profile