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 - dumps css & javascript after the form

March 13, 2011 8:52am

Subscribe [4]
  • #1 / Mar 13, 2011 8:52am

    Communitas

    59 posts

    Sorry, this is just such an elementary question,  but I have spent 1 hour on it now and I’m tearing my hair out ...

    My Safecracker form puts out a lot of CSS and JavaScript code after the form.  This sounds similar to the following problem mentioned in this thread
    http://ellislab.com/forums/viewthread/182269/
    but it never got addressed or resolved there.

    I’m guessing I’m doing something wrong with the stylesheet link<link href=”{path=css/_ee_saef_css}” type=“text/css” rel=“stylesheet” media=“screen” />,  but I cannot for the life of me find out what.

    Any help much appreciated

    Michael

  • #2 / Mar 14, 2011 3:41am

    John Henry Donovan

    12339 posts

    Michael,

    The thread you linked to was more of a feature request than an issue really.
    What version of both EE and SC are you using?

    What exactly is your specific issue? Is your form not taking styles or missing some?
    Are you trying to get it to work with third-party add-ons?
    Can you share your code with us?

  • #3 / Mar 14, 2011 7:53pm

    Communitas

    59 posts

    Hi John, thanks for your reply - I had vaguely thought this might be a common beginner’s error and instantly recognisable as elementary.
    I am using (on a local install using MAMP PRO):
    Version 2.1.3 Build 20101220
    SafeCracker   2.0
    Main other modules are Calendar, Matrix and Playa.

    I won’t paste here the whole long page of code that is being output after the form,  but it typically looks something like this:

    “,“closeWith”:”“,“className”:“btn_encode”},{"name":"bl","key":"T","openWith":" target=\"_blank\" /","closeWith":"","className":"btn_bl"},{"name":"br","key":"R","openWith":"
    ","closeWith":"","className":"btn_br"}]}; myWritemodeSettings = {"nameSpace":"html","onShiftEnter":{"keepDefault":false,"replaceWith":"
    \n"},“onCtrlEnter”:{“keepDefault”:false,“openWith”:”\n
    “,“closeWith”:”

    The code I’m using is a straight copy from the Users Guide of the long Safecracker form,  which I’ve pasted straight into a page in my template group ‘forms’.  I then embed that form in the simplest of pages of my site with just a head and body,  and I then include the link to the recommended stylesheet with the recommended path in the head of that document (css/_ee_saef_css).  Now the form itself actually works alright,  and I can edit entries without a problem -  it’s just that this page-long code appears after the form.

    Thanks for your help

    Michael

  • #4 / Mar 15, 2011 11:04am

    Sue Crocker

    26054 posts

    Hi, Michael. Let’s have you simplify the form for testing purposes. If you don’t have it embedded anywhere, does the code work as expected?

  • #5 / Mar 15, 2011 11:29am

    Communitas

    59 posts

    Thanks, Sue.
    No, if I just render the page with the Safecracker form pasted straight in, same thing happens.
    I get the labels and fields (some empty, some pre-filled with the contents of the entry if I give an entry_id in the url).
    I then get the ‘submit’ button, and then all this code of which I pasted about a quarter in a previous message (starting: “,“closeWith”:” etc etc).

    All I have changed at the top of the Safecracker form is the channel, I think, and the return path (which I can leave out and makes no difference), like this:
    {exp:safecracker channel="resources" return="forms/edit/ENTRY_ID" entry_id="{segment_3}”}

    {exp:safecracker channel="resources" entry_id="{segment_3}”}

      <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” />

      <select name=“custom_field_name” id=“custom_field_name”>
      {options:custom_field_name}
          <option value=”{option_value}”{selected}>{option_name}</option>
      {/options:custom_field_name}

      </select>


      {status_menu}
          <label for=“status”>Status</label>
          <select name=“status” id=“status”>

          {select_options}
          </select>
      {/status_menu}

      <label for=“entry_date”>Date</label>
      <input type=“text” name=“entry_date” id=“entry_date” value=”{entry_date}” maxlength=“23” size=“25” />

      <label for=“expiration_date”>Expiration Date</label>
      <input type=“text” name=“expiration_date” id=“expiration_date” value=”{expiration_date}” maxlength=“23” size=“25” />

      <label for=“comment_expiration_date”>Comment Expiration Date</label>
      <input type=“text” name=“comment_expiration_date” id=“comment_expiration_date” value=”{comment_expiration_date}” maxlength=“23” size=“25” />

      <label class=“checkbox”><input type=“checkbox” name=“sticky” value=“y”  {sticky} /> Make Entry Sticky</label>

      <label class=“checkbox”><input type=“checkbox” name=“allow_comments” value=“y” {allow_comments} /> Allow Comments</label>

      <label class=“checkbox”><input type=“checkbox” name=“dst_enabled” value=“y” {dst_enabled} />DST Active on Date of Entry</label>

      {category_menu}
          <label for=“categories”>Categories</label>
          <select name=“category[]” id=“categories” size=“4” multiple=“multiple”>

          {select_options}
          </select>
      {/category_menu}
     
      {if captcha}
          <label for=“captcha”>Please enter the word you see in the image below:</label
          {captcha}

          <input type=“text” name=“captcha” value=”{captcha_word}” maxlength=“20” />
      {/if}

      <input type=“submit” name=“submit” value=“Submit” />

    {/exp:safecracker}

    Thanks ...

    Michael

  • #6 / Mar 16, 2011 6:46am

    John Henry Donovan

    12339 posts

    Michael,

    you have 2 opening exp:safecracker tags in your example above. Is that just to show us what you changed or does it exist in the form?

    {exp:safecracker channel="resources" return="forms/edit/ENTRY_ID" entry_id="{segment_3}"}
    
    {exp:safecracker channel="resources" entry_id="{segment_3"}

    Can you try re-uploading the SC module files to rule out any corruption please?

    Check that your template type is set to Webpage.

    Was this a fresh install of EE or a upgrade from another version or build?

  • #7 / Mar 18, 2011 2:27pm

    helain le blanc

    10 posts

    Hi

    This is crazy…
    Yesterday all good. the SAEF was working
    Today on the morning : the SAEF was not working anymore.

    “,“className”:“btn_email”}]}; myWritemodeSettings = {"nameSpace":"html","onShiftEnter":{"keepDefault":false,"replaceWith":"
    \n"},“onCtrlEnter”:{"keepDefault":false,"openWith":"\n

    ","closeWith":"
    \n"},“markupSet”:[{"name":"b","key":"B","openWith":"","closeWith":"","className":"btn_b"},{"name":"i","key":"I","openWith":"","closeWith":"","className":"btn_i"},{"name":"p","key":"P","openWith":"

    ","closeWith":"
    ","className":"btn_p"},{"name":"blockquote","key":"Q","openWith":"

    ","closeWith":"

    ","className":"btn_blockquote"},{"name":"a","key":"","openWith":"","closeWith":"","className":"btn_a"},{"name":"img","key":"","replaceWith":"","className":"btn_img"},{"name":"email","key":"","openWith":"\,closeWith:\","className":"btn_email"}],“onTab”:{"keepDefault":false,"replaceWith":"\t"}}; // ]]>

    The tag is simply :

    {exp:safecracker channel="cv_membre" return="annuaire/mod_cv"}
    Nom du CV
    <input type="text" name="title" id="title" value="{title}" size="25" maxlength="100"  /></p>
    {custom_fields}
    {if file} {display_field}{/if} 
    {/custom_fields}
    <input type="submit" value="Envoyer" />
    {/exp:safecracker}

    I’ve spend the DAY to resolve the issue but no way.
    I’ve re-upload the files, even the whole EE system folder 2.1.3 with of course all the third party folders, without succes…

    I’ve tried on the same web server, but on a different domain the SAEF tag, and it was working…

    I’m stuck…

    Any idea ?
    THKS

  • #8 / Mar 18, 2011 2:39pm

    Communitas

    59 posts

    Dear John,

    have done as suggested, and re-download and re-uploaded SC modules, same thing.
    Template type IS set to webpage. I am working on a local installation on MAMP Pro, fresh install.

    Yes, the two opening tags were just the two options I tried with and without return path.

    I had assumed others had come across this, and it was a simple error on my part that would be easy to sort out.
    It looks to me more and more like I have managed to create some obscure anomaly.
    I will try to work it on a completely clean install, but won’t have time to get round to that now for a few days.
    If anybody else has any ideas in the meantime, much appreciated, but otherwise let me experiment and I’ll get back to you.

    Thanks

    Michael

  • #9 / Mar 18, 2011 2:46pm

    helain le blanc

    10 posts

    Dear John

    I’ve found a solution

    I had made a htm button for encoding email like in EE 1, because my client wanted to use it.
    And since then I had the errors

    So i’ve just trash this html button and… tadam !!! the SAEF work again

    The try to remove any of your html button you’ve created and tell me if it work !

    The button was formatted like this :

    Opening tag : {encode="
    closing tag :"}

  • #10 / Mar 18, 2011 3:35pm

    Communitas

    59 posts

    Hi everybody,

    thanks to helain le blanc who appears to have had the same problem as me,  but has managed to trace it.

    I had defined a similar encode HTML button weeks ago, and it has been safely sitting in my system without a problem since then.
    It would never have occurred to me to trace the problem with Safecracker to that.
    Following helain’s post, I deleted the button and it immediately cleared up the Safecracker problem.
    Thank you so much for that -  brilliant!

    Michael

  • #11 / Mar 20, 2011 9:38am

    Sue Crocker

    26054 posts

    Thanks for the assist, helain!

    Michael, glad things are working again.. Feel free to start a new thread if you have any more questions.

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

ExpressionEngine News!

#eecms, #events, #releases