jQWidgets Forums

jQuery UI Widgets Forums Editors DateTimeInput DateTimeInput empty value

This topic contains 3 replies, has 2 voices, and was last updated by  TomiG. 10 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • DateTimeInput empty value #61446

    TomiG.
    Participant

    The value of a datetime input field cannot be delete with keyboard.
    It’s very important to delete for example in a search form or any other case if a date field is not required.
    Also very annoying that the empty value is equal with current date. Empty value is empty, not today’s date.

    Is there any solution for this problems?

    It would be great if datetime input also have a placeholder, because of reasons above.

    DateTimeInput empty value #61448

    TomiG.
    Participant

    I found the solution one of my problems:
    The Delete button clears the field. (The Backspace only set the date to 01/01/1900.)

    DateTimeInput empty value #61452

    Nadezhda
    Participant

    Hello TomiG.,

    You can set ‘value’ property to null if you are set ‘allowNullDate’ property to true. Here is an example which shows how to add placeholder to the input field.

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <title></title>
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
        <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
        <script type="text/javascript" src="../../scripts/demos.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdatetimeinput.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcalendar.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxtooltip.js"></script>
        <script type="text/javascript" src="../../jqwidgets/globalization/globalize.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                // Create a jqxDateTimeInput
                $("#jqxDateTimeInput").jqxDateTimeInput({ width: '250px', height: '25px' });
                // Focus the jqxDateTimeInput
                $("#jqxDateTimeInput").jqxDateTimeInput('focus');
                $('#inputjqxDateTimeInput').attr('placeholder', 'Select date');
            });
        </script>
    </head>
    <body>
        <div id='content'>
            <div id='jqxDateTimeInput' >
            </div>        
        </div>
    </body>
    </html>

    Best Regards,
    Nadezhda

    jQWidgets team
    http://www.jqwidgets.com/

    DateTimeInput empty value #61453

    TomiG.
    Participant

    It works!
    Thank you for your help!

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

You must be logged in to reply to this topic.