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 return not working after successful save

September 04, 2012 9:51pm

Subscribe [1]
  • #1 / Sep 04, 2012 9:51pm

    gsl_admin

    4 posts

    Hi All,

    Having a bit of a frustrating time here.  I’m working on a very very dead simple SafeCracker form.  3 fields, nothing spectacular.  I’m sure that it’s just that I’m doing something stupid, but for some reason once I submit the form it returns to a blank page.  Now, all the data is being saved correctly, and I’ve turned on the debugging and I’m not getting errors, the return is just not working for me for some reason.  Here is my form:

    {exp:channel:entries channel="vendors" author_id="{member_id}" status="open" limit="1"}
        {exp:safecracker channel="vendors" entry_id="{entry_id}" return="profiles/profile" include_jquery="no" safecracker_head="no"}
    <ul>
        <li>
          <label class="required"><div>{label:shipping_policy}</div><span>{instructions:shipping_policy}</span></label>
          <textarea name="shipping_policy" class="textarea large">{shipping_policy}</textarea>
        </li>
        <li>
            <label class="required"><div>{label:refund_policy}</div><span>{instructions:refund_policy}</span></label>
            <textarea name="refund_policy" class="textarea large">{refund_policy}</textarea>
        </li>
        <li>
            <label class="required"><div>{label:customization_policy}</div><span>{instructions:customization_policy}</span></label>
            <textarea name="customization_policy" class="textarea large">{customization_policy}</textarea>
        </li>
        <li class="form-footer">
            <button type="submit" class="bttn-green"><span>Save Policies</span></button>
        </li>
    </ul>
        {/exp:safecracker}
    {/exp:channel:entries}

    Am I missing something here?  Like I said before, I’m super frustrated right now, so just a fresh pair of eye can probably pick out whats wrong.

    Thanks for your help.

    ~ Lucas

  • #2 / Sep 06, 2012 2:26pm

    Dan Decker

    7338 posts

    Hi Lucas,

    Thanks for posting your questions on the forums!

    Thank you for providing the template code, that’s a great first step!

    Let’s look at what you’ve got going on here. You’ve wrapped SafeCracker in a channel entries pair. What are you trying to do there? SafeCracker can work independently based on information in the URL.

    One other thing that stands out is the safecracker_head parameter. The use of that expects that you intend to place the {safecracker_head} tag elsewhere in your template, within the SafeCracker tags. SafeCracker still needs the code in the head, the parameter just lets you relocate it in the event it could conflict.

    On a related note, the query_no parameter expects that you are supplying your own version elsewhere in your template.

    Now, give this a try for me:

    {exp:safecracker channel="vendors" entry_id="{segment_3}" return="profiles/profile" include_jquery="no" safecracker_head="no" author_only="yes"}
    <ul>
        <li>
          <label class="required"><div>{label:shipping_policy}</div><span>{instructions:shipping_policy}</span></label>
          <textarea name="shipping_policy" class="textarea large">{shipping_policy}</textarea>
        </li>
        <li>
            <label class="required"><div>{label:refund_policy}</div><span>{instructions:refund_policy}</span></label>
            <textarea name="refund_policy" class="textarea large">{refund_policy}</textarea>
        </li>
        <li>
            <label class="required"><div>{label:customization_policy}</div><span>{instructions:customization_policy}</span></label>
            <textarea name="customization_policy" class="textarea large">{customization_policy}</textarea>
        </li>
        <li class="form-footer">
            <button type="submit" class="bttn-green"><span>Save Policies</span></button>
        </li>
    </ul>
    {safecracker_head}
        {/exp:safecracker}

    This revision tells SafeCracker to expect the entry_id in segment_3 of the URL and the author_only parameter makes sure only the author, logged in, will be allowed to edit the entry.

    Let me know if that works!

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases