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 & jQuery

February 17, 2012 5:16am

Subscribe [1]
  • #1 / Feb 17, 2012 5:16am

    eddyfever

    62 posts

    I have some trouble with jQuery and safecracker.

    I have now my own jquery 1.7. in the header of my page.
    But when i use safecracker there is a conflict.

    Safecracker overrides my own jquery. Now i already tried to use include_jquery=“no” but with no success.
    When i use include_jquery=“no” then my layout works perfect but not my safecracker fields like: date, matrix etc…

    Is there a way so safecracker understands my jquery in the header.

    idea: {embed="*/*"} the safecracker form?
    Thank you already for your time.

  • #2 / Feb 18, 2012 12:32pm

    Dan Decker

    7338 posts

    Hi eddyfever,

    I’m sorry you are having conflicts with jQuery and SafeCracker.

    Have you tried loading your instance of jQuery at the bottom of the page rather than the head? Also, for things like date fields to work, you need to include jQuery UI as well.

    Post your SafeCracker template here for us to have a look at. That way we can take a crack at troubleshooting this with you.

    Cheers,

  • #3 / Feb 18, 2012 1:13pm

    eddyfever

    62 posts

    Hi Dan thanks for your reply.

    Yeh i tryed to load jquery add the bottom.

    //Edit// Yep this works now when i load all scripts add the bottom, except for the date field which works fine when i load the query add the top.
    Do i still need to insert the jQuery UI by hand?

    //Edit2// Also the safecracker file field has some issues in a other form, i can’t remove a file which i inserted.

    //Edit3// I don’t think to load all scripts at the bottom is the solution because i get a lot of faults in my other forms.

    I think my safecracker form contains noting special. All straight forward and for the date field i use this.
    //Don’t mind the messy code i still need to clean it up 😉

    {exp:safecracker channel="taken" return="project/{segment_4}" entry_id="{segment_3}"}
       <fieldset>
        <table>
         <tr>
          <td>Klant: <input readOnly type="text" size="30" value="{klant_link_taak}{title}{/klant_link_taak}" class="disabled">
          </td>
          <td>Project: <input readOnly type="text" size="30" value="{project_link}" class="disabled">
          </td>
          <td>Status: 
           <select name="category[]" id="categories">
                  {categories}
                         <option value="{category_id}"{selected}>{category_name}</option>
                  {/categories}
           </select>
          </td>
          <td>Uren: 
    <input name="taak_uren" id="taak_uren" value="{taak_uren}" size="3" maxlength="3" type="text">
          </td>
         </tr>
        </table>
       </fieldset>
      
       <fieldset>
        <table>
         <tr>
          <td valign="top" width="50%">
           Taak naam: <input name="title" type="text" size="45" id="{title}" value="{title}"><hr>
           Taak omschrijving: 
           
    <textarea name="taak_omschrijving" id="taak_omschrijving" cols="60">{taak_omschrijving}</textarea>
           
          </td>
          <td width="50%" valign="top">
    <!-- DATE FIELD!!!-->  Datum uitvoering: {field:taak_datum} 
           <hr>
           Door: {field:taak_medewerker}
           <hr>
           <span class="icon"></span> Verwijder taak: <input name="status" type="checkbox" value="closed"/> 
           
    <input class="blue" type="submit" name="submit" value="Bewaar Taak">
          </td>
         </tr>
        </table>
       </fieldset>
    {/exp:safecracker}
  • #4 / Feb 23, 2012 5:10pm

    Kevin Smith

    4784 posts

    Hi eddyfever,

    It sounds like you’re wresting with some jQuery conflict issues. You do need jQuery set for your other forms, but not if SafeCracker is already setting it. I was able to get this solved for myself last year and shared it here. Does that help you?

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

ExpressionEngine News!

#eecms, #events, #releases