jQWidgets Forums

jQuery UI Widgets Forums Editors DateTimeInput Date Range PHP

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  w424637 11 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Date Range PHP #18323

    w424637
    Member

    I’m using the date range widget as below.
    At the moment if I have the following echo $_POST[“mycontent”]; in my destination page – report.php then it returns the following format:

    07/08/2013 – 15/08/2013

    How can i return the two dates as two different post variables?

    $(document).ready(function () {
    var theme = getDemoTheme();
    // create jqxcalendar.
    $(“#jqxWidget”).jqxDateTimeInput({ width: 250, height: 25, theme: theme, selectionMode: ‘range’ });

    $(“#jqxWidget”).on(‘change’, function (event) {
    var selection = $(“#jqxWidget”).jqxDateTimeInput(‘getRange’);
    if (selection.from != null) {
    $(“#selection”).html(“

    From: ” + selection.from.toDateString() + ” To: ” + selection.to.toDateString() + “

    “);
    }
    });

    var date1 = new Date();
    date1.setFullYear(2013, 7, 7);

    var date2 = new Date();
    date2.setFullYear(2013, 7, 15);
    $(“#jqxWidget”).jqxDateTimeInput(‘setRange’, date1, date2);

    });

    Date Range PHP #18324

    Peter Stoev
    Keymaster

    Hi w424637,

    In order to achieve that, you may use the following 2 options:

    1. With Ajax.
    2. With two hidden input fields on your form – one for the start and another for the end date.

    You can get the range via the “getRange” method. The “from” and “to” fields return the range’s start and end JavaScript dates. Having that, you can populate the hidden input fields or send ajax request. You can also get the range’s text parts using the following:

                   var text = $("#jqxWidget").val();
    var date1 = text.substring(0, text.indexOf('-'));
    var date2 = text.substring(text.indexOf('-') + 2);

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Date Range PHP #18342

    w424637
    Member

    Excellent – many thanks for the help

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.