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 Answers 2

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).

-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.

4
  • Nope, a snippet changes nothing in regards to variable collision or parse order. Commented Jan 20, 2012 at 21:32
  • Mmmh that's what I did here and it works. Snippet is parsed first. loweblog.com/downloads/ee-parse-order.pdf
    – pvledoux
    Commented Jan 23, 2012 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. Commented Jan 23, 2012 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
    Commented Jan 27, 2012 at 11:04

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.