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.

jqery is disable using safecrack

February 17, 2012 3:17pm

Subscribe [2]
  • #1 / Feb 17, 2012 3:17pm

    dliu

    18 posts

    Hi,
    The jquery worked well when I used user module. Now I want to build a form by using safecracker module. The Jquery does not work anymore. Even I use the “include_jquery=“no”“, it still does not work. It seems like that my jquery script is ignored.

  • #2 / Feb 19, 2012 6:37am

    Sean C. Smith

    3818 posts

    Hi dliu,

    I’m sorry that you are having trouble with jquery and safecracker. To better help you I need to ask a few more questions. What version of ExpressionEngine are you using? When you say jquery does not work anymore what exactly is happening? Are you seeing any errors in the browser? More context on your page would be very helpful. Could you post up the entire template code here between [ code][ /code] tags or use pastie.

    Sean

  • #3 / Feb 21, 2012 1:41pm

    dliu

    18 posts

    Hi Sean,

    I am using version 2.2.2 of ExpressionEngine. I did not see any errors in the browser.

    Following is code I used.

    {if logged_in}
    
    {embed="dan_test/header"}
    
    [removed][removed]
    [removed][removed]
    [removed][removed]
    
    [removed]
    $(document).ready(
     function(){
      
      $("#publishForm").validate({
        rules: {
        focusAreaHiddenField: {validateFocusAreas: ""}
       }
      });
     }
    );
    
    jQuery.validator.addMethod(
     "validateFocusAreas", 
     function(value, element, param) {
      return $(".research_focus_area_group:checked").length
     }, 
     "Select at least one Focus Area."
    );
    
    [removed]
     {if segment_3 == "success"}
    <div class="user_success">You have successfully updated your profile!</div>
    {if:else}
    Fill in or edit the fields below to update your profile.
    
    <font color="#ff0000">*</font><b> Required Field</b>
    
    {exp:user:edit form:id="edit_profile_form" form:name="edit_profile_form"}
    
    <table>
     <tbody>
     
     {exp:safecracker channel="member_profiles" url_title="{username}" logged_out_member_id="{member_id}" preserve_checkboxes="yes" include_jquery="no" error_handling="inline" return="dan_test/edit_profile/success"}
     
     <tr class="alt">
      <td valign="top">
       <font color="#ff0000">*</font>
       <strong><label for="first_name">First Name:</label></strong> 
                
    <i>(e.g. John)</i>
      </td>
      <td valign="top">
      
        <input name="first_name" type="text" id="first_name" value="{first_name}" size="30" maxlength="100" class="required">
       
            </td>
      
     </tr>
     <tr class="alt">
      <td valign="top">
       <font color="#ff0000">*</font>
       <strong><label for="last_name">Last Name:</label></strong> 
                
    <i>(e.g. Smith)</i>
            </td>
            <td valign="top">
       
       <input type="text"  name="last_name" id="last_name" value="{last_name}" size="30"  maxlength="100" class="required">
      </td>
     </tr>
     
     
       
    
      <tr class="alt">
      <td valign="top">
       <font color="#ff0000">*</font>
       <strong><label for="shoot_type">Research Focus Area (check all that you know apply):</label></strong>
      </td>
      <td class="focus_area_td">
             <div class="right"><input type="hidden" name="focusAreaHiddenField" id="focusAreaHiddenField"/></div>
     
    
      {custom_fields}
    {if checkbox}
      {options}
      
             <label>
                <input type="checkbox" id="test_check2" name="test_check2[]" value="{option_value}" {checked} >{option_value}<br>
            </label>
      
        {/options}
     
    
     {/if}
    {/custom_fields} 
    
     </td>
     </tr>
     
     
     <tr class="alt">
    
      <td valign="top">
    
       <!--p><font color="#ff0000">*</font-->
       
       <strong><label for="content_description">Full Research Summary: </label></strong> 
    
                
    <i>Please provide a more detailed summary of your research.</i>
    
      </td>
    
      <td valign="top">
        
       <textarea wrap="virtual" rows="20" name="research_long_summary" id="research_long_summary"  cols="60">{research_long_summary}</textarea>
      </td>
    
     </tr>
     
     <tr>
    
      <td> </td>
    
      <td>
       <input type="submit" name="submit" value="Submit" />
       </td>
    
     </tr>
      
     {/exp:safecracker}
    
    </tbody>
    
    </table>
    
    {/exp:user:edit}
    
    {/if}

     


    dliu

     

  • #4 / Feb 24, 2012 1:00pm

    Kevin Smith

    4784 posts

    Hi dliu,

    I hate to ask this, but can I get you to paste your code into Pastie? And provide the link to it here? Since your question focuses on JavaScript, there’s was supposed to be a lot in the code you posted above, but the forum filters have removed it all. I’ll be subscribed to this thread so that I can see your reply and respond sometime today.

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

ExpressionEngine News!

#eecms, #events, #releases