cat_id is not being populated in a hidden field
Posted: 29 February 2008 10:06 PM   [ Ignore ]
Newbie
Rank
Total Posts:  1
Joined  2007-01-01

Thanks so much for making Form Helper!

I’m having a bit of trouble, everything seems to be working fine, except the hidden input that needs to be assigned the {cat_id} variable.
Here is my code:

{ls_header}

{exp
:weblog:entry_form weblog="ls_ticket" return="localsearch/tickets"}
{exp
:weblog:entries}

<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}" />

<
h3>LcocalSearch Ticket ID: {entry_id}</h3>
<
h3>{title}</h3>
<
textarea name="{exp:form_helper:field_grabber field_name='description'}" cols="50" rows="20" />
{exp:form_helper:field_parser}{description}{/exp:form_helper:field_parser}
</textarea>
<
br />
<
br />
<
select name="status">
{exp:form_helper:statuses entry_id="{entry_id}" exclude="open"}
<option value="{entry_status}" {selected}>{entry_status}</option>
{/exp:form_helper:statuses}
</select>
<
br />
<
input type="submit" name="submit" value="Submit" />

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

{ls_footer}

When rendered this is what view source returns:

<input type="hidden" name="entry_id" value="4" />
<
input type="hidden" name="title" value="Test 2" />
<
input type="hidden" name="entry_date" value="2008-02-25 12:44 AM" />
<
input type="hidden" name="category[]" value="{cat_id}" />

<
h3>LcocalSearch Ticket ID: 4</h3>
<
h3>Test 2</h3>
<
textarea name="field_id_4" cols="50" rows="20" />
This is the second test of the SAEF
</textarea>
<
br />
<
br />
<
select name="status">

<
option value="Bug Report" >Bug Report</option>

<
option value="Critical" >Critical</option>

<
option value="Feature Request" >Feature Request</option>

<
option value="closed" >closed</option>

</
select>
<
br />
<
input type="submit" name="submit" value="Submit" />


</
form>

If you will note that the raw variable tag {cat_id} is being left in place instead of the actual value, ie: 4

Is there something I’ve missed?
Thanks in Advance for any help you might offer.

EDIT:Addition
Also, in the code above, the

<select>

menu that i’m trying to generate for the statuses is not applying the

{selected}

option that the

{exp:form_helper:statuses}

tag is supposed to supply.

Thanks again!

Profile
 
 
Posted: 03 March 2008 07:34 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3343
Joined  2006-10-18

For the cat_id problem, you’ll need to wrap the {categories}{/categories} variable pair around it smile

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

For the Status problem, try using the {checked} variable instead of the {selected} variable (it works with checked, although selected seems to not work… but they do the same thing) wink

<select name="status">
{exp:form_helper:statuses entry_id="{entry_id}" exclude="open|closed|hamsandwich"}
<option value='{entry_status}' {checked}>{entry_status}</option>
{/exp:form_helper:statuses}
</select>

 Signature 
Profile