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.

SAEF (not) setting custom field text format

November 30, 2010 1:07pm

Subscribe [4]
  • #1 / Nov 30, 2010 1:07pm

    Sophie Dennis

    31 posts

    I am having trouble with entries submitted via SAEF. I have tracked this down to how the SAEF is specifying the text format for my custom fields. Or rather, how it’s not setting the text formatting. Although I have a workaround, I wanted to post here to find out either a) what I’m doing wrong or b) so this can be filed properly as a bug.

    The default text formatting for the custom field is set to ‘Textile’ (using the first-party Textile Add-on). If I manually add a hidden field

    <input name="field_ft_ID" type="hidden" value="Textile" />

    (where ID matches the ID of the custom field) everything is fine. I believe the SAEF {custom_fields} loop ought to be adding this hidden field for me, but it isn’t. I have tried re-copying the {custom_fields} sample code from the Docs (http://ellislab.com/expressionengine/user-guide/modules/channel/entry_form.html), but still no hidden field_ft_ID fields.

    Without the hidden field viewing an entry submitted via SAEF gives the following PHP error:

    A PHP Error was encountered
    
    Severity: Warning
    
    Message: EE_Typography::require_once(/home/svn/dev/sophie4/edit/expressionengine/third_party//pi..php) [ee-typography.require-once]: failed to open stream: No such file or directory
    
    Filename: libraries/EE_Typography.php
    
    Line Number: 467
    
    
    Fatal error: EE_Typography::require_once() [function.require]: Failed opening required '/home/svn/dev/sophie4/edit/expressionengine/third_party//pi..php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/svn/dev/sophie4/edit/expressionengine/libraries/EE_Typography.php on line 467

    I believe this means that no field formatting is being set. Interestingly even toggling the field formatting in the CP doesn’t properly reset it to Textile. Adding entries directly via the CP is fine, and uses Textile quite happily.

    I am happy with the workaround of hard-coding the hidden field on this form, but would like to understand the bug or what I’m doing wrong for the future.

  • #2 / Nov 30, 2010 5:57pm

    Ingmar

    29245 posts

    Can you show us a little more of your SAEF code? Also, what version and build of EE are you using?

  • #3 / Nov 30, 2010 7:33pm

    Sophie Dennis

    31 posts

    This is the SAEF code, as simplified for testing:

    {exp:channel:entry_form channel="blog" return="/discuss" preview="/newpost" status="Pending" form_class="saef"}
    <div class="post">
    <label for="title">Title</label> <input type="text" name="title" id="title" value="{title}" size="50" maxlength="100"></p>
    
    {custom_fields}
    {if required}* {/if}{field_label}
    
    {field_instructions}
    
    {if textarea}
    <textarea id="{field_name}" name="{field_name}" dir="{text_direction}" cols="50" rows="{rows}">{field_data}</textarea><br >
    {/if}
    {if textinput}
    <input type="text" dir="{text_direction}" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50"><br >
    {/if}
    {if pulldown}
    <select id="{field_name}" name="{field_name}">
    {options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
    
    </select>
    {/if}
    {if date}
    <input type="text" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50"><br >
    {/if}
    {if relationship}
    <select id="{field_name}" name="{field_name}">
    {options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
    
    </select>
    {/if}
    {if multiselect}
    <select id="{field_name}" name="{field_name}[]" multiple="multiple">
    {options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
    </select>
    {/if}
    {if checkbox}
    {options}{option_value} <input type="checkbox" id="{field_name}" name="{field_name}[]" value="{option_value}"{checked} />
    {/options}
    {/if}
    {if radio}
    {options}{option_value} <input type="radio" id="{field_name}" name="{field_name}" value="{option_value}"{checked} />
    {/options}
    {/if}
    
    {if file}
        {file}
    {/if}
    {/custom_fields}
    
    
    <input type="submit" name="submit" value="Submit" />
    
    </div>
    
    {/exp:channel:entry_form}

    I’ll post the rendered source in the next reply (it’s too long to post both blocks as one comment).

    I am running Build:20100810 of EE 2.1.0. I’m aware I need to try updating to the newest release.

  • #4 / Nov 30, 2010 7:36pm

    Sophie Dennis

    31 posts

    This is the rendered source (via View Source):

    <form id="publishForm" class="saef" method="post" action="http://sophie4.dev.cayenne.co.uk/blog/newpost.test"  enctype="multipart/form-data" > 
    <div class='hiddenFields'>
    <input type="hidden" name="ACT" value="5" /> 
    <input type="hidden" name="RET" value="http://sophie4.dev.cayenne.co.uk/blog/newpost.test" /> 
    <input type="hidden" name="PRV" value="/newpost" />
    <input type="hidden" name="URI" value="blog/newpost.test" /> 
    <input type="hidden" name="XID" value="09a2de2cc6193a651d3ac78813cc932d51ae61b4" /> 
    <input type="hidden" name="return_url" value="/discuss" /> 
    <input type="hidden" name="author_id" value="1" />
    <input type="hidden" name="channel_id" value="1" />
    <input type="hidden" name="status" value="Pending" />
    <input type="hidden" name="site_id" value="1" />
    </div> 
     
    [removed]// <![CDATA[ 
    if (typeof EE == "undefined" || ! EE) { var EE = {"BASE":"http://sophie4.dev.cayenne.co.uk/?","THEME_URL":"http://sophie4.dev.cayenne.co.uk/themes/cp_themes/default/","PATH_CP_GBL_IMG":"http://sophie4.dev.cayenne.co.uk/themes/cp_global_images/","filebrowser":{"endpoint_url":"ACT=6","window_title":"File Manager","theme_url":"http://sophie4.dev.cayenne.co.uk/themes/cp_themes/default/"},"lang":{"or":"or","resize_image":"Resize Image","return_to_publish":"Return to Publish","confirm_exit":"confirm_exit","add_new_html_button":"add_new_html_button"},"publish":{"show_write_mode":true,"title_focus":true,"smileys":false},"user_id":"1"};}
    mySettings = {"nameSpace":"html","onShiftEnter":{"keepDefault":false,"replaceWith":"
    \n"},"onCtrlEnter":{"keepDefault":false,"openWith":"\n","closeWith":"\n"},"markupSet":[{"name":"p","key":"p","openWith":"","closeWith":"","className":"btn_p"},{"name":"h2","key":"","openWith":"<h2>","closeWith":"</h2>","className":"btn_h2"},{"name":"h3","key":"","openWith":"<h3>","closeWith":"</h3>","className":"btn_h3"},{"name":"ul","key":"u","openWith":"<ul>","closeWith":"</ul>","className":"btn_ul"},{"name":"ol","key":"o","openWith":"<ol>","closeWith":"</ol>","className":"btn_ol"},{"name":"b","key":"b","openWith":"<strong>","closeWith":"</strong>","className":"btn_b"},{"name":"i","key":"i","openWith":"<em>","closeWith":"</em>","className":"btn_i"},{"name":"blockquote","key":"q","openWith":"<blockquote><p>","closeWith":"</p>
    </blockquote><p>","className":"btn_blockquote"},{"name":"a","key":"a","openWith":"<a href="#%22&gt%22,%22closeWith%22:%22&lt/a&gt%22,%22className%22:%22btn_a%22},{%22name%22:%22img%22,%22key%22:%22%22,%22replaceWith%22:%22%22,%22className%22:%22btn_img%22}&#93}myWritemodeSettings" class="post">Remove File</a><br />
    <input type="hidden" name="field_id_21_hidden" value="" /></p></div><div class="no_file js_hide"><input type="file" name="field_id_21" value="" /></p><select name="field_id_21_directory"><option value="1">Files</option><option value="2">Steering Group Files</option></select></div><div class="modifiers js_show"><a href="#" class="choose_file">Add File</a></div></div> <br />
     <br />
     <br />
    <input type="submit" name="submit" value="Submit" /> <br />
     <br />
    </div> <br />
     <br />
    </form>

  • #5 / Dec 01, 2010 9:40am

    Sue Crocker

    26054 posts

    Hi, Sophie. Where did you get the EE2 version of Textile?

  • #6 / Dec 01, 2010 10:31am

    Sophie Dennis

    31 posts

    That’s a good question! it was quite a while ago when I first started developing the site. I assumed I’d got it from http://expressionengine.com/downloads/details/textile/ but looking at that page it suggests that version is only for EE v1. Checking the plugin code suggests it may be the modified version in this forum thread (http://ellislab.com/forums/viewthread/137184/), which I may have found via Devotee.

    At the top of the plugin file it says

    /**
    *  Textile plugin for ExpressionEngine 2.x
    *  Slightly modified Version to cover the core changes from EE 1.x -> EE 2.x
    */

    Generally the plugin seems to be working fine, and I’m using Textile quite happily for most of the posts on the site. It’s only when submitting via the SAEF that I have a problem.

    Could you confirm whether or not I should be getting the hidden file_ft fields with the SAEF anyway?

  • #7 / Dec 02, 2010 2:37am

    John Henry Donovan

    12339 posts

    Sophie,

    I have fully tested this with EE2.1.1 just now and could not generate an error it works fine.
    I installed the plugin by add the textile folder to my third_party folder.

    In my custom filed I choose Textile for my formatting.

    I then used the standard SAEF example from the docs to create an entry. Adding some textile markup as I did so.

    In my template I added my textile tags around my field

    {exp:textile}
    {news_extended}
    {/exp:textile}

    and viewed the entry on the front end and no error.


    So what you may need to do is upgrade your version of EE. Make sure you follow
    version upgrade instructions and not build update instructions

  • #8 / Dec 02, 2010 7:24am

    Sophie Dennis

    31 posts

    Thanks for the reply.

    Are you getting the hidden format fields in your SAEF?

    As I can fix the problems completely by manually adding the field_ft fields to the SAEF, I feel that is at least part of the problem.

    I am using Textile without the textile tags btw. Some entries use non-textile formatting so I can’t blanket apply textile to all the templates. This is working fine for all entries except those created using the SAEF.

  • #9 / Dec 02, 2010 5:35pm

    Ingmar

    29245 posts

    Can you please try to upgrade to the latest version and build as suggested by John Henry?

  • #10 / Dec 03, 2010 7:45am

    Sophie Dennis

    31 posts

    Yes, that is my next task, as I’m hoping it may help with various other random bugs we’ve been getting as well. I am busy on other projects today so it may not happen until after the weekend.

    I would really appreciate, however, getting an answer to my core question of whether the SAEF is *supposed* to include the hidden field_ft fields by default? Do they appear on John Henry’s test version? If not, then that obviously isn’t something any upgrade will fix.

  • #11 / Dec 03, 2010 4:59pm

    Sue Crocker

    26054 posts

    When I created an SAEF file with a textile field, there wasn’t a hidden field_ft field. I just used the sample in the documentation to add an entry. So please do upgrade.

  • #12 / Dec 06, 2010 10:52am

    Sophie Dennis

    31 posts

    I see that 2.1.2 is due for release this month. Rather than upgrade twice in one month I’m going to skip the 2.1.1 update and go straight to 2.1.2. If I am still having issues with SAEF after upgrading to 2.1.2 I’ll re-open this.

    Thanks for your help so far.

  • #13 / Dec 06, 2010 5:51pm

    Ingmar

    29245 posts

    Very good. Let’s keep this thread open a little longer, then. Let us know how it goes, please.

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

ExpressionEngine News!

#eecms, #events, #releases