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 default status

March 29, 2011 8:15am

Subscribe [5]
  • #1 / Mar 29, 2011 8:15am

    JusTyMe

    76 posts

    Hi!

    I wonder how can I set a default status with my Safecracker form. I have a custom status named “Draft”. How can I set this as the default choice?

    best regards,
    Jay

  • #2 / Mar 29, 2011 11:47am

    Mark Bowen

    12637 posts

    Hi Jay,

    I might be wrong on this but I’m fairly sure that Safecracker should adhere to whatever status you put into :

    Admin > Channel Administration > Channels > Edit Preferences (Your Channel) > Administrative Preferences

    Perhaps give that a go and see if it works.

    Hope that helps a bit.

    Best wishes,

    Mark

  • #3 / Mar 29, 2011 11:49am

    Mark Bowen

    12637 posts

    Saying that, looking at the documentation it does seem as though there is a setting for that.

  • #4 / Mar 29, 2011 6:44pm

    Sue Crocker

    26054 posts

  • #5 / Mar 31, 2011 7:59am

    JusTyMe

    76 posts

    Hi Jay,

    I might be wrong on this but I’m fairly sure that Safecracker should adhere to whatever status you put into :

    Admin > Channel Administration > Channels > Edit Preferences (Your Channel) > Administrative Preferences

    Perhaps give that a go and see if it works.

    Hope that helps a bit.

    Best wishes,

    Mark

    I did this but still the status won’t show as default for new entries. By the way, it will work for new entries if the status is not included in the SAEF form. So it will automatically use the default.

    Maybe jumping into the documentation will help.

    Thanks again….

    Cheers,
    Jay

  • #6 / Mar 31, 2011 8:01am

    JusTyMe

    76 posts

    Also see:

    http://eehowto.com/index.php/howto/articles/howto-set-the-default-status-for-a-safecracker-entry

    Does that help?

    Hi Sue!

    Sorry but partially yes. Check my quote for Prof. Mark.

    cheers,
    Jay

  • #7 / Mar 31, 2011 8:14am

    JusTyMe

    76 posts

    I had a solution already but I am still getting annoyed if this is the proper way to do it for now.

    {status_menu}
        <label for="status">Status</label>
        <select name="status" id="status">
            <option value="Draft">Draft</option> - I added this to be the default
            {select_options} - Draft exist here as well
        </select>
    {/status_menu}

    best regards,
    Jay

  • #8 / Mar 31, 2011 12:33pm

    Lisa Wess

    20502 posts

    Hi, JustTyMe,

    The defaults set in the CP mean anything in the form, as sent by the user, will be ignored.  From the docs:

    You may set the following settings per channel.
    Default Status - Set a default status for this channel. Any user-submitted status will be ignored.

    Are you hoping to set a default and let users change that option when submitting?

  • #9 / Apr 01, 2011 5:27am

    JusTyMe

    76 posts

    Are you hoping to set a default and let users change that option when submitting?

    You are right Lisa!

    My Statuses: Open, Close Draft (default) and Archive

    I have an SAEF but OPEN still appears as the default status even though I declared it explicitly in the Safecrackers CP that “DRAFT” is my default status.

    By the way, the solution that I sent isn’t working as well. :-(

    Do you have s solution for this. All I want is Safecracker should produce an HTML where DRAFT appears to be the first choice.

    Thanks in advance…

    best regards,
    Jay

  • #10 / Apr 03, 2011 2:54pm

    Greg Salt

    3988 posts

    Hi Jay,

    There is no reason that you can’t specify the exact HTML you want to appear in the select (similar to what you tried earlier). You can for example just do this:

    {status_menu}
        <label for="status">Status</label>
        <select name="status" id="status">
            <option value="draft">Draft</option>
        <option value="open">Open</option>
        <option value="closed">Closed</option>
        </select>
    {/status_menu}

    Does that help?

    Cheers

    Greg

  • #11 / Apr 04, 2011 7:25am

    JusTyMe

    76 posts

    Thanks Greg!

    Hard coded but will work anyway.

    I will use this solution for now. I hope Safecracker will generate dynamic option lists having the default status as the first choice for future developments.

    Actually, I haven’t think to hard code it LOL. I am used to dynamic contents maybe that is why….

    cheers,
    Jay

  • #12 / Apr 04, 2011 7:32am

    JusTyMe

    76 posts

    By the way here is the solution.

    {if segment_3 == ""} {!--New entry--}
        <option value="Draft">Draft</option> {!--Hard coded to list Draft as the first choice--}
        <option value="open">Open</option>
        <option value="closed">Closed</option>
        <option value="Archive">Archive</option>
    {if:else} {!--Edit existing entry, to generate dynamic list (get selected status)--}
        {select_options}
    {/if}

    Hope this can be useful with others. I am not sure if this is the best solution but this works with my case right now.

    Warning! This solution is crucial when status fields are changed…

    cheers,
    Jay

  • #13 / Apr 04, 2011 4:19pm

    Sue Crocker

    26054 posts

    Hi, Jay. That will work.. But I do have a question for you. With what kind of user where you testing this with? A SuperAdmin, visitor or what exactly?

  • #14 / Apr 05, 2011 3:41am

    JusTyMe

    76 posts

    Hi Sue!

    Those users with Channel entry privilege. Visitors and groups who doesn’t have privilege won’t have access to safecracker as far as I know. They will get a template without the SAEF.

    Don’t close this thread yet so that I can make a report when we are already finished testing.

    best regards,
    Jay

  • #15 / Apr 05, 2011 4:14am

    JusTyMe

    76 posts

    By the way, If you have a default status in the Safecracker control panel. This status will still dominate in a new entry even though you declared “Draft” explicitly as your status when you submitted the SAEF.

    Jay

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

ExpressionEngine News!

#eecms, #events, #releases