We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5529
    • 70 Posts
    I just have a form on my site it needs a datepicker. I thought for sure I’d find a snippet or something.

    Am I overlooking something like that? Or, do I need to put my own in there with scriptalicious or something?
      • 3749
      • 24,544 Posts
      I’m not sure where the js code is but there’s one in NewsPublisher:

      <a onClick="nwpub_cal2.popup();" onMouseover="window.status=\'Select date\'; return true;" onMouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><img align="absmiddle" src="manager/media/images/icons/cal.gif" width="16" height="16" border="0" alt="Select date" /></a>


      Bob
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 5529
        • 70 Posts
        Quote from: BobRay at Jan 16, 2008, 03:21 PM

        I’m not sure where the js code is but there’s one in NewsPublisher:

        <a onClick="nwpub_cal2.popup();" onMouseover="window.status=\'Select date\'; return true;" onMouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><img align="absmiddle" src="manager/media/images/icons/cal.gif" width="16" height="16" border="0" alt="Select date" /></a>


        Bob



        Thanks for the tip. I thought it was a great idea. When I copied the code you gave, it didn’t work and the image didn’t show up. I did find the image here:

        manager/media/calendar/img/cal.gif

        It didn’t work however. I wish I knew where to look for the js file so I could call it.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The file mutate_content.dynamic.php has this:
          <script type="text/javascript" src="media/script/datefunctions.js"></script>
          

          This code is at the bottom of the file:
          <script type="text/javascript">
              var cal1 = new calendar1(document.forms['mutate'].elements['pub_date'], document.getElementById("pub_date_show"));
              cal1.path="<?php echo str_replace("index.php", "media/", $_SERVER["PHP_SELF"]); ?>";
              cal1.year_scroll = true;
              cal1.time_comp = true;
          
          
              var cal2 = new calendar1(document.forms['mutate'].elements['unpub_date'], document.getElementById("unpub_date_show"));
              cal2.path="<?php echo str_replace("index.php", "media/", $_SERVER["PHP_SELF"]); ?>";
              cal2.year_scroll = true;
              cal2.time_comp = true;
          
          </script>
          

          The actual code for the calendars for publishing documents, one for setting a date and the other for clearing a date:
          <a onclick="documentDirty=false; cal1.popup();" onmouseover="window.status='<?php echo $_lang['select_date']; ?>'; return true;" onmouseout="window.status=''; return true;" style="cursor:pointer; cursor:hand"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/cal.gif" width="16" height="16" border="0" alt="<?php echo $_lang['select_date']; ?>" /></a>
                                  <a onclick="document.mutate.pub_date.value=''; document.getElementById('pub_date_show').innerHTML='(<?php echo $_lang['not_set']?>)'; return true;" onmouseover="window.status='<?php echo $_lang['remove_date']?>'; return true;" onmouseout="window.status=''; return true;" style="cursor:pointer; cursor:hand"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/cal_nodate.gif" width="16" height="16" border="0" alt="<?php echo $_lang['remove_date']; ?>" /></a>

          It’s all rather ugly; I’m sure there are nicer date picker scripts available now. But this is what the Manager still uses, and it works just fine.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 27708 MODX Staff
            • 2,502 Posts
            Quote from: sottwell at Jan 16, 2008, 04:57 PM

            ...and it works just fine.
            Um, err...okay? laugh

            The date picker is tricky to use, my clients all hate it because you can’t pick a day and then a time. The JS is a mess to configure and it really should be completely externalized, and there are problems with the popup sizes (can’t always see the far right column) in Firefox and it will be a great day when this puppy goes poopoo. I would like to see a better date picker in 0.9.7.

            Cheers,

            Jay
              Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Ah. Sorry, I’ve never had occasion to use the thing myself, and have never gotten any complaints from any clients (from your comment I would presume they’ve never used it either).
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                http://www.nogray.com/time_picker.php
                http://nogray.com/calendar.php

                This one is really nice too, offers month and year selection options, but no time picker
                http://www.electricprism.com/aeron/calendar/
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 27708 MODX Staff
                  • 2,502 Posts
                  Sus smileyan,

                  No need to apologize, I was being a little melodramatic. grin That being said thanks for looking into others. i will check them out.

                  Cheers,

                  Jay
                    Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
                    • 27708 MODX Staff
                    • 2,502 Posts
                    That frequency decoder widget is nice! I like accessibility and I like the various versions for different applications. Seems like it is missing a time field. I may add this one to my MODx arsenal.

                    Cheers,

                    Jay
                      Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      True, but that time picker is so cute! An analog clockface, and you drag the hands to set the time you want!
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org