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.

JS error in Safecracker File field

October 15, 2012 5:25am

Subscribe [1]
  • #1 / Oct 15, 2012 5:25am

    Russ Back

    142 posts

    Hi guys

    I’ve seen a few mentions of this throughout the forums but I can’t get any of the resolutions to work. I have a simple SAEF which has two Safecracker Field fields. On the front end I get this error in the console:

    Uncaught TypeError: Object [object Object] has no method ‘markItUp’

    Here’s my SAEF code:

    [removed][removed] {!-- required for saef js :-\ --}
    
    {exp:safecracker 
     channel="job_preferences" 
     return="account/cv-upload/updated" 
     id="form-job-preferences" 
     class="validate" 
     {if embed:entry_id}
      entry_id="{embed:entry_id}"
     {/if} 
     preserve_checkboxes="yes" 
     require_entry="no" 
     status="Open" 
     include_jquery="no"
     error_handling="inline"
     }
     
     {exp:freemember:members member_id="CURRENT_USER"}
      <input type="hidden" name="title" value="Member ID {member_id} ({first_name} {last_name})">
     {/exp:freemember:members}
     
     <input type="hidden" name="status" value="Open">
                 
     <fieldset>
     
      <legend></legend>
      
      <div class="cf large-input">
       <span class="label-large-input">Attach cover Letter</span>
       {field:cover_letter}
       <span class="field-note">Must be .doc, .docx, .pdf or .rtf and 1Mb or less</span>
       <label class="error">{error:cover_letter}</label>
      </div>
      
      <div class="cf large-input">
       <span class="label-large-input">Attach CV</span>
       {field:cv}
       <span class="field-note">Must be .doc, .docx, .pdf or .rtf and 1Mb or less</span>
       <label class="error">{error:cv}</label>
      </div>
            
     </fieldset>
     
     <div class="form-cta submit-form">
         <input type="image" class="btn btn-primary" alt="Save " src="/site_themes/emea/assets/images/save-button.jpg">
        </div>
     
    {/exp:safecracker}

    You can see that I’m including jQuery manually to ensure that the same version is used on all pages, with SAEF or otherwise.

    Any suggestions please?

    Thanks

  • #2 / Oct 16, 2012 1:11pm

    Robin Sowell

    13255 posts

    Hi Russ- what version of EE are you running?  There was a bug that I believe was related.  If you’re on 2.5.3 and experiencing this?  I’d start by simplifying.  Put it all in one template, make sure to put the jquery script before Safecracker, I’d drop the embed for the moment as well as the {exp:freemember:members} tag.  Just see if it works.  If so- add back in one at a time.  Make sense?

  • #3 / Oct 16, 2012 1:23pm

    Russ Back

    142 posts

    Sorry, this site is on 2.5.2. Was there a fix applied in 2.5.3?

  • #4 / Oct 17, 2012 10:58am

    Robin Sowell

    13255 posts

    No, it looks like the main fix was before 2.5.2.  Here’s a report in the tracker on 2.5.2 with the same error where include_jquery set to ‘no’ and then called all the js in the header, and the issue resolved.  Which is confusing- but let’s see if it works.

  • #5 / Nov 06, 2012 3:47am

    Russ Back

    142 posts

    Thanks Robin. It turns out that jquery was loading twice (once in Safecracker, once in a footer embed). I thought I’d added logic for that but it I’d got the logic slightly wrong - now working fine.

    Sorry to bother you.

  • #6 / Nov 06, 2012 4:51pm

    Robin Sowell

    13255 posts

    Appreciate the update- it will no doubt help someone else in the future!  Glad you’re squared away, Russ.

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

ExpressionEngine News!

#eecms, #events, #releases