ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

safecracker problem with url_title parameter

May 06, 2011 1:59pm

Subscribe [4]
  • #1 / May 06, 2011 1:59pm

    Brian M.

    529 posts

    Hi there - I’m having a problem with safecracker. When I use the url_title parameter, no {custom_field} or {field:custom_field} tags are working. {custom_field} doesn’t parse at all - {custom_field} shows up in the content. And {field:custom_field} doesn’t do anything (no HTML is generated).

    So this code works properly (notice the entry_id):

    {exp:safecracker require_entry="yes" channel="events" author_only="yes" return="events/manage/thank_you/" entry_id="9014"}
    
    <label for="title"><span class="required">*</span> Event Name</label>
    <input id="title" class="inputLong" type="text" name="title" value="{title}" maxlength="128" />
    
    <label for="event_summary"><span class="required">*</span> One Sentence Summary</label>
    <input id="event_summary" class="inputLong" type="text" name="event_summary" value="{event_summary}" maxlength="200" />
     
    <input class="button" type="image" name="submit" src="/css/images/button_update_event.gif" />
    
    {/exp:safecracker}

    While this code doesn’t (changing entry_id to the associated url_title):

    {exp:safecracker require_entry="yes" channel="events" author_only="yes" return="events/manage/thank_you/" url_title="tester"}
    
    <label for="title"><span class="required">*</span> Event Name</label>
    <input id="title" class="inputLong" type="text" name="title" value="{title}" maxlength="128" />
    
    <label for="event_summary"><span class="required">*</span> One Sentence Summary</label>
    <input id="event_summary" class="inputLong" type="text" name="event_summary" value="{event_summary}" maxlength="200" />
     
    <input class="button" type="image" name="submit" src="/css/images/button_update_event.gif" />
    
    {/exp:safecracker}

    {title} works in both (as do all the built-in fields like entry_date, etc.).  But custom fields just return {custom_field} with url_title.

    Thanks for the help!

  • #2 / May 08, 2011 2:42pm

    Greg Salt

    3988 posts

    Hi Brian,

    I’m afraid that I can’t replicate this on my local installation of version 2.1.3 build 20110411 and SC 2. Which versions and build are you using?

    Cheers

    Greg

  • #3 / May 09, 2011 11:32am

    Brian M.

    529 posts

    Hmmm I’m on EE 2.1.3 build 20101220 and SC 2.

  • #4 / May 10, 2011 1:20pm

    Lisa Wess

    20502 posts

    Hi, Brian,

    That is a bit of a strange one you’ve got going on there. Can you show us a screenshot of the Entry with that URL title, including the URL title field in the screenshot?

    Also, what other extensions are you running at the moment?

    We may need to have a look at this one, but let’s get a bit more information first.

    Thank you!

  • #5 / May 10, 2011 2:14pm

    Brian M.

    529 posts

    Hi Lisa,

    Sorry… You’d like a screenshot from the front end or the entry in the CP? 

    Here’s the extensions I’m running currently:

    Beech
    NSM .htaccess Generator
    SafeCracker
    Structure
    Super Search

    So my next step is probably to duplicate the site, turn off all the add-ons, and test on that?

  • #6 / May 10, 2011 6:27pm

    Brandon Jones

    5500 posts

    Hi Brian,

    You can disable all extensions using the large button in the upper right of Addons > Extensions. Do not disable them individually. Try creating a new entry after the extensions have been disabled, and seeing if SafeCracker grabs that new entry’s url_title.

    I believe Lisa wanted a screenshot from within the control panel. Let us know how you progress, please!

  • #7 / May 11, 2011 10:03am

    Brian M.

    529 posts

    Thanks to you both for the help.  I think I’ve figured out the problem.

    So, somehow I’ve got 2 entries in the database with the same URL title - I didn’t think that was possible?  The safecracker tag isn’t honoring the channel=“events” parameter, it is just looking for the url_title when I use that parameter.  Because there are two entries with the url_title of tester, it takes the first one which is the wrong one (in a different channel) and because it doesn’t use the same fields, it shows things like {event_summary} instead of the value.

    So it seems like there’s either one or two bugs going on here.  I’m still confused about how there could be two identical URL titles (can you do that if they’re in different channels?).  That’s one problem, but I’m not sure how it happened so I can’t tell you how to recreate it and so it’s probably not a bug but a ‘glitch’ 😉 I made a new tester entry and it correctly changed the url_title to tester1. 

    The real bug seems to be that safecracker isn’t honoring the channel parameter when using the url_title parameter. I can recreate this: If I use the url_title of an entry from a different channel then it shows that entry in the SAEF, breaking the SAEF. That’s one I bet you can duplicate.

    Thanks again for your help - I’ll probably just use entry_id until this gets fixed.

  • #8 / May 12, 2011 6:12am

    John Henry Donovan

    12339 posts

    Brian,

    I think you are on to something and I can replicate this. I have created a bug report here on your behalf. Thanks for your troubleshooting

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases