0

I have this entry form

{exp:safecracker channel="channel_name" return="url/ENTRY_ID" entry_id="{segment_3}" author_only="yes" include_jquery="no" class="nice"}

<label for="title">Week Title</label>
<input type="text" name="title" id="title" value="{title}" size="50" maxlength="100" class="input-text">   
<label for="challenge">Select Challenge</label>
<select name="challenge">
<option value=""> -- </option>
{exp:channel:entries channel="channel_name2" username="CURRENT_USER" dynamic="no"}
<option value="{entry_id}">{title}</option>
{/exp:channel:entries}
</select> 
...
{/exp:safecracker}

"Challenge" field dropdown returns {entry_id} correctly but not the {title}. {title} params is blank.

Any tips?

2 Answers2

2

You are encountering namespace collision - {title} is populated first by your Channel Entries tag, but then overwritten by SafeCracker, as it's the outermost module tag. {entry_id} will also fail once you're editing an existing entry rather than creating a new one.

Solve this by embedding your Channel Entries tag (a snippet, as suggested by pvledoux, will not help in this case).

Derek Hogue
  • 4,589
  • 1
  • 15
  • 27
-1

Nesting channel:entries in safecracker is maybe not the best way. You'll probably get better result if you put your channel:entries tag in a snippet.

pvledoux
  • 973
  • 1
  • 10
  • 23
  • Nope, a snippet changes nothing in regards to variable collision or parse order. – Derek Hogue Jan 20 '12 at 21:32
  • Mmmh that's what I did here and it works. Snippet is parsed first. http://loweblog.com/downloads/ee-parse-order.pdf – pvledoux Jan 23 '12 at 11:00
  • Apologies, I was unaware ... I was under the impression that the "parsing" of snippets at that point was only their inclusion in the template, not actually running tags that are included in them. – Derek Hogue Jan 23 '12 at 18:19
  • 1
    In fact, I have to apologies, I'm wrong. In our case, we are not using title variable, but custom fields only, so I was sure it was ok. In fact, Dereck, you are right, it is an inclusion. I owe you a virtual beer ;) – pvledoux Jan 27 '12 at 11:04