Forums Forums Search & Filter Pro Search by date for ancient documents

Viewing 10 posts - 21 through 30 (of 58 total)
  • Anonymous
    #184708

    OK!

    Anonymous
    #184837
    This reply has been marked as private.
    Trevor
    #184845
    This reply has been marked as private.
    Anonymous
    #184861
    This reply has been marked as private.
    Trevor
    #184999

    OK, see the code on this page:

    http://newspapers1908.tolstoy.ru/wp-admin/post.php?post=233&action=edit

    The list of dates are those with NO documents (and are disabled).

    As it is now, the datepicker month year are back and forwards. Before the month was dropdown and year was locked. Either is possible. Which do you want?

    You disable a new date by adding it. You enable a date by removing it.

    The basic code is this:

    var $myBadDates = new Array("01/01/1908",
    ...list of dates...
    "31/12/1908"
    );
    function checkBadDates(mydate){
    var $return=true;
    var $returnclass ="available";
    $checkdate = jQuery.datepicker.formatDate('dd/mm/yy', mydate);
    for(var i = 0; i < $myBadDates.length; i++)
        {    
           if($myBadDates[i] == $checkdate)
              {
            $return = false;
            $returnclass= "unavailable";
            }
        }
    return [$return,$returnclass];
    }
    jQuery(document).on("sf:init", ".searchandfilter", function(){
      jQuery("#search-filter-form-108 .sf-datepicker").datepicker("destroy");
      jQuery("#search-filter-form-108 .sf-datepicker").datepicker({
        dateFormat: 'dd/mm/yy',
        yearRange: '1908:1908',
        defaultDate: '1/1/1908',
        beforeShowDay: checkBadDates
      });
    });
    jQuery(document).on("sf:ajaxfinish", ".searchandfilter", function(){
      jQuery("#search-filter-form-108 .sf-datepicker").datepicker("destroy");
      jQuery("#search-filter-form-108 .sf-datepicker").datepicker({
        dateFormat: 'dd/mm/yy',
        yearRange: '1908:1908',
        defaultDate: '1/1/1908',
        beforeShowDay: checkBadDates
      });
    });
    Trevor
    #185001

    At the moment it stores the date incorrectly, so I need to fix that, I think. Tomorrow for that coding.

    Anonymous
    #185023

    Trevor, thank you very much, everything is just fine! The only thing – when searching by date Ajax output of results doesn’t work. You must press the “Show” button. About “stores the date incorrectly”, unfortunately, didn’t understand…

    Trevor
    #185033

    Can you give me a date to test with where there is already a document entered in WordPress so I can test with that?

    Trevor
    #185050

    I looked at this again this morning. It all seems to be working, yes?

    Anonymous
    #185085

    > Can you give me a date to test with where there is already a document entered in WordPress so I can test with that?

    1/08/1908, for example.

    > I looked at this again this morning. It all seems to be working, yes?

    Yes, with the exception of Ajax displaying of the results. But if it’s hard to do, I can disable Ajax for the entire form.

    Thank You!

Viewing 10 posts - 21 through 30 (of 58 total)