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.

Using Fixed/Localized flag with SAEF

July 17, 2011 10:05pm

Subscribe [4]
  • #1 / Jul 17, 2011 10:05pm

    ivisionteam

    7 posts

    Hi I have installed Safecracker and created a Stand Alone Entry Form to post to a channel I have created.  2 of the fields in my channel are dates and I am able to choose a date using the datepicker just fine.  However, I would like to also be able to set the “Fixed/Localized” flag using the Form. In the EE GUI, it is implemented as a dropdown and seems to be only associated with the date fields.  Please let me know how this can be accomplished.

    All help is greatly appreciated!

    Thanks!

  • #2 / Jul 18, 2011 6:40pm

    Brandon Jones

    5500 posts

    Hi ivisionteam, and welcome to the forums!

    What version of EE are you using? Can you show us the relevant parts of your SafeCracker code?

  • #3 / Aug 01, 2011 4:39pm

    ivisionteam

    7 posts

    We are running on Version 2.1.3 Build 20101220.  How would I set the “Fixed” or “Localization” setting on the date fields? Here is my Safecracker code:

    
    									
  • #4 / Aug 03, 2011 3:32pm

    Brandon Jones

    5500 posts

    Hi ivisionteam,

    This would currently be a feature request, and a great one IMO.

  • #5 / Aug 19, 2011 12:49pm

    Stephen T

    127 posts

    I just submitted a feature request for this: http://ellislab.com/forums/viewthread/197187/

    Brandon or other EE Support person - I’m not sure if part of this isn’t a bug as well.  I have a Safecracker form with custom date fields.  Those fields are being automatically assigned the “Localized” preference when the form is submitted, but the default is “Fixed” and I want them to be submitted as “Fixed”, not “Localized”.  Can you let me know if you think this should be submitted as a bug as well?

  • #6 / Aug 22, 2011 6:50pm

    Dan Decker

    7338 posts

    Stephen T,

    Are you also on ExpressionEngine 2.1.3? That version contains numerous bugs and we strongly recommend updating to latest version. Report back with your version number and we’ll go from there 😊

    Cheers,

  • #7 / Aug 22, 2011 6:57pm

    Stephen T

    127 posts

    Hi Dan,

    I’m on EE 2.2.1.  Let me know what other info you need from me.

  • #8 / Aug 23, 2011 6:58pm

    Dan Decker

    7338 posts

    Stephen T,

    Are users required to be logged in to post/edit entries? Have you double checked if users are allowed to set their own date localization preferences? Members-> Preferences-> Allow members to set their own localization preferences?

    Cheers,

  • #9 / Aug 24, 2011 6:16pm

    Stephen T

    127 posts

    Hi Dan,

    Users are not required to be logged in to post entries.

    I have doubled checked the member preferences and members are not allowed to set their own localization preferences.

    Any other ideas?  It doesn’t really make sense to me why these custom date fields are being automatically assigned the “Localized” parameter.  Shouldn’t they default to “Fixed”?

    Thanks for your help.

  • #10 / Aug 25, 2011 8:12pm

    Dan Decker

    7338 posts

    Stephen T,

    I’m sorry this continues to be an issue for you. You said you were on EE 2.2.1, where are you seeing an option to set Localized vs. Fixed? I don’t have those options when I make a new custom date field. Can you post your SafeCracker template so I can test it locally?

    Cheers,

  • #11 / Aug 31, 2011 4:15pm

    Stephen T

    127 posts

    Hi Dan,

    I’ve attached an image of the custom date fields.  These are just out of the box, standard custom date fields in my install of EE 2.2.1.  This channel has two custom date fields.  The top one was submitted through the Safecracker form and the bottom one wasn’t.  The fields default to “Fixed” when you submit a channel entry through the control panel, but default to “Localized” when submitted through the Safecracker form.

    Here’s the relevant code from the Safecracker form:

    {exp:safecracker channel="channel_name" logged_out_member_id="##" status="closed" secure_action="yes" secure_return="yes" return="template_group/template-meets-submit-thanks"}                
        <label class="description" for="date_field_start">Start Date <span class="required">*</span></label>
        <input type="text" id="date_field_start" name="date_field_start" value="{date_field_start}" />
    
        <label class="description" for="date_field_end">End Date (if the event lasts longer than one day) </label>
        <input type="text" id="date_field_end" name="date_field_end" value="{date_field_end}" />
    
        <input id="saveForm" type="submit" name="submit" value="Submit" />
    {/exp:safecracker}

    Thanks again for your help.  I’ve taken out some of the safecracker form fields just to focus on the two date fields, but if you want me to post all of it, let me know.

  • #12 / Aug 31, 2011 9:54pm

    Dan Decker

    7338 posts

    Steven T,

    Great news, I have a solution that I have tested that will hopefully get this squared away.

    What I did was mimic your setup, to a degree, with a custom date field. While in my publish page, I used Safari’s built-in web inspector to inspect the element of the “Fixed/Localized” dropdown. What this allowed me to see what the “raw” field name for that dropdown. In my case it was “field_offset_3” (for reference, my date field’s raw name is field_id_3). Safecracker will respect and use these “raw” values, but obviously it’s is easier to use the field names you give them. For this to work, I made an input type=“hidden” in my safecracker template with the value=“n” (the value of the “fixed” option in the dropdown). I used this template to submit an entry, and when I looked at the entry in the Control Panel, the custom date field was set to “Fixed” 😊

    Here is my template for your reference:

    {exp:safecracker channel="journal" return="main/awesome"}
    
    <label for="title">Title</label>
    
    <input type="text" name="title" id="title" value="{title}" size="50" maxlength="100">
    
    <label for="url_title">URL Title</label>
    
    <input type="text" name="url_title" id="url_title" value="{url_title}" maxlength="75" size="50" />
    
    Date 
    
    
    <input type="text" name="entry_date" value="{entry_date}" maxlength="23" size="25" /></p>
    
    <input type="text" name="my_date" value="{my_date}">
    
    <input type="hidden" name="field_offset_3" value="n" />
    
    
    <textarea name="body"></textarea>
    <input type="submit" name="submit" value="Submit" />
    {/exp:safecracker}

    I’ll just point out again that *your* raw field names will most likely be different, so use whatever means you are comfortable with to determine that. Also note that any *other* custom date fields you create in the future will have different raw values. The raw value will be consistent *within* the same channel fields group, however.

    I hope this helps, and let us know if we can be of further assistance.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases