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 Datepicker Not Working

September 07, 2012 4:01am

Subscribe [2]
  • #1 / Sep 07, 2012 4:01am

    This question may be related to a resolved thread.

    This is the SC code we use:

    {exp:safecracker channel="requests"}
    
        <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">
    
    {/exp:safecracker}

    and when we view the template - datepicker does not fire.

    I’ve read the resolution to the above link and unfortunately it did not work for us since our dev site is 99% configured like our live site but unlike the live site, the date picker works there, same CP settings, all addons, modules, plugins and extensions enabled. Just does not work on our live site.

    We conducted some script debugging and found out that these lines of the source code are automatically being commented out.

    // <![CDATA[
    //$(document).ready(function() {
     //if (typeof SafeCracker == "undefined" || ! SafeCracker) { var SafeCracker = {markItUpFields:{}};}
     //$.datepicker.setDefaults({dateFormat:$.datepicker.W3C+EE.date_obj_time});
     //$.datepicker.setDefaults({defaultDate: new Date(1347003653000)});
     $("input[name=expiration_date]").datepicker();
     $("input[name=comment_expiration_date]").datepicker();});
    // ]]>

    Even if we hard code an uncommented version, the source code still outputs the lines commented out! - which could most probably be the root cause or related to the problem.

    On a closely related note, the http://site.com/?ACT=jquery&ui=datepicker shows “Disallowed Key Characters.” when accessed via the browser (404) and if we correct the url by removing the “amp;” into—-> http://site.com/?ACT=jquery&ui=datepicker - it pull up the jQuery UI Datepicker source.

    We’ve enabled and disabled all our addons - no date picker
    We’ve changed the .htaccess files and returned the index.php mod to default settings - no date picker.
    We’ve reinstalled safecracker v2.1 - no date picker
    We have EE 2.5.2.

    Any inputs are greatly appreciated.

     

  • #2 / Sep 10, 2012 10:48am

    Dan Decker

    7338 posts

    Hi chiwayentertainment,

    Thank you for all the information you’ve provided!

    I have a couple of questions to get you a solution.

    Are you providing your own version of jQuery? If so, you need to make use of the include_jquery= parameter.

    Have you included SafeCracker assets in your template? When the template is sent to the browser, if you look at the source, is the date field being given the class “hasdatepicker”?

    If you could, I would love to see the whole template and the rendered HTML. Use http://pastie.org/ if you need to.

    Cheers,

     

  • #3 / Sep 10, 2012 12:04pm

    Hi Dan,

    Responses below:

    Are you providing your own version of jQuery? If so, you need to make use of the include_jquery= parameter.

    We used our own jquery and jqueryiu and used the include_jquery=yes parameter and we got nothing

    Have you included SafeCracker assets in your template?
    Yes, we included the SF css

    When the template is sent to the browser, if you look at the source, is the date field being given the class “hasdatepicker”?
    None when you do not manually assign class=“hasdatepicker” . If you do the input field suddenly gets a calendar image

    If you could, I would love to see the whole template and the rendered HTML. Use http://pastie.org/ if you need to.

    Here is the template code

    {exp:safecracker channel="requests"}

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

    {/exp:safecracker}

    Here is the rendered templated
    http://pastie.org/4696517

    I dont know if this is related but we just discovered that captcha does not work on SF even though we’ve modified the channel settings to allow captcha - no image is generated on the SF form but Captcha works when registering.

    Thanks!

  • #4 / Sep 11, 2012 11:54am

    Dan Decker

    7338 posts

    We used our own jquery and jqueryiu and used the include_jquery=yes parameter and we got nothing

    “yes” is the default, if you supply your own jQuery, you need to use include_jquery=“no”.

    I built a test using this code in ExpressionEngine 2.5.2:

    <!DOCTYPE html>
    <html lang="en">
     <head>
      <meta charset="UTF-8">
    <link href="{path=css/_ee_saef_css}" type="text/css" rel="stylesheet" media="screen">
    <link href="assets/style.css" rel="stylesheet" media="screen">
    < script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></ script>
      <title>New Page</title>
     </head>
      
     <body>
      {exp:safecracker channel="sandbox" include_jquey="no"}
    
      <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">
    
    {/exp:safecracker}
     </body>
    </html>

    The date picker worked as expected. Would you like for us to come in for a look?

    Cheers,

     

  • #5 / Sep 18, 2012 2:48pm

    Yes please!

    BTW, I tried your code on one of our test templates and the date picker still did not fire.

    I can PM you the login credentials for the site.

    Thanks!

  • #6 / Sep 18, 2012 2:56pm

    HI Dan,

    I tried sending you a PM but your inbox said it was full.

    Let mw know how I can send you the credentials.

    Thanks!

  • #7 / Sep 20, 2012 4:47pm

    Shane Eckert

    7174 posts

    Hey chiwayentertainment,

    Please be on the lookout for an email from EllisLab.

    Cheers,

  • #8 / Sep 21, 2012 3:15pm

    Hi Shane,

    Credentials sent!

    Kindly confirm receipt.

    Let us know if there is anything else we can provide you.

    Thanks

  • #9 / Sep 24, 2012 3:30pm

    Dan Decker

    7338 posts

    Hi Aldo,

    Thanks for sending along the details! Shane will be following up with you in private and once we track this down, we’ll post back here with the solution.

    Cheers,

  • #10 / Sep 24, 2012 3:41pm

    Awesome Thanks!

  • #11 / Sep 26, 2012 2:10pm

    Robin Sowell

    13255 posts

    And just to close the public loop- it does look like this was caused by a third party add-on.  It purposely comments out those lines.

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

ExpressionEngine News!

#eecms, #events, #releases