jQWidgets Forums
jQuery UI Widgets › Forums › Editors › DateTimeInput › DateTimeInput empty value
Tagged: allowNullDate, datetimeinput, delete, jqxdatetimeinput, value
This topic contains 3 replies, has 2 voices, and was last updated by TomiG. 10 years, 7 months ago.
-
Author
-
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.
I found the solution one of my problems:
The Delete button clears the field. (The Backspace only set the date to 01/01/1900.)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,
NadezhdajQWidgets team
http://www.jqwidgets.com/It works!
Thank you for your help! -
AuthorPosts
You must be logged in to reply to this topic.