2013-05-29 17:03
浏览 38


I love this jQuery datepicker that I want to implement on a PHP form with other input boxes

When the user hits a submit button they are brought to another page update.php where the form data is obtained via POST.

I'm looking for a line to add to the javascript so I can somehow access the array of multiple dates in the multiple datepicker via POST:

var latestMDPver = $.ui.multiDatesPicker.version;
        var lastMDPupdate = '2012-03-28';
  var dates = $('#simpliest-usage').multiDatesPicker('getDates');

            // Version //
            //$('title').append(' v' + latestMDPver);
            $('.mdp-version').text('v' + latestMDPver);
            $('#mdp-title').attr('title', 'last update: ' + lastMDPupdate);

            // Documentation //
            $('i:contains(type)').attr('title', '[Optional] accepted values are: "allowed" [default]; "disabled".');
            $('i:contains(format)').attr('title', '[Optional] accepted values are: "string" [default]; "object".');
            $('#how-to h4').each(function () {
                var a = $(this).closest('li').attr('id');
                $(this).wrap('<'+'a href="#'+a+'"></'+'a>');
            $('#demos .demo').each(function () {
                var id = $(this).find('.box').attr('id') + '-demo';
                $(this).attr('id', id)
                    .find('h3').wrapInner('<'+'a href="#'+id+'"></'+'a>');

            // Run Demos
            $('.demo .code').each(function() {
                eval($(this).attr('title','NEW: edit this code and test it!').text());
                this.contentEditable = true;
            }).focus(function() {
                        .after('<button class="test">test</button>')
                        .next('.test').click(function() {
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douzhi0107
    douzhi0107 2013-05-29 17:12

    Looking at the plugin you can store the range as a common seperated list in a regular input field. Use jquery to disable to field from direct entry so people can't "mess it up" then after you post you an implode the field on a comma and then you will have your array.

    点赞 评论
  • douhuang3833
    douhuang3833 2013-05-29 17:19

    I'm not sure if that's what you're looking for, but if you need to access the dates passed to the script via POST just do this:

    $dates = explode(',', $_POST['simpliest-usage']);
    点赞 评论