how to disable bootstrap-dateTimepicker's pick function? - function

now, I am trying to disable the pick function for some reason, I just want to display the date/time, but it can't be done, it seems that there is no such option or function to reach this? Anyone has an idea why this is the case?

I find that in the latest version of datetimepicker, there is a option "ignoreReadonly", it's default value is false and we don't change it. Just to make add the readonly attribute to the input. Then we can disable the widget.
In my old version, there is no such option. so, thanks for your answers and thanks Eonasdan. by the way, the version contains this option, is 4.14+.
And you can view the demo by [disabled datetimepicker demo](https://jsfiddle.net/xjkms/hzwpsnjw/2/).

Related

How to reset polymer iron-autogrow-textarea or paper-textarea through it's methods?

I am able to clear iron-autogrow-textarea by setting the value to empty string but I am unable to clear the newline or reset it. I am using event on keycode enter which works but leaves this new line and no way I can find a way to reset the iron-autogrow-textarea to its initial state.
If anything similar can be done with paper-textarea, I can use that instead.
Any help appreciated.
Here below information is written in its own page, so you need to update with : ironAutogrowTextarea.value
Imperatively updating ironAutogrowTextarea.value will update the
textarea.value
instead ironAutogrowTextarea.textarea.value
Imperatively updating ironAutogrowTextarea.textarea.value will update
the display, but not update the internal value
Written its demo link: https://www.webcomponents.org/element/#polymer/iron-autogrow-textarea/demo/demo/index.html

PhpStorm combine multiple Predefined Live Template functions

I have a project where my files are in "lisp-case" (hyphen delimited) and I would like to use the filename as a variable in a live template, but it must be converted to CamelCase first.
I found out that you can set the expression fileNameWithoutExtension() under "Edit Template Variables" and there is also a function called camelCase() which should be able to turn my filenames into CamelCase. But I cannot figure out how to combine those two. I tried doing camelCase(fileNameWithoutExtension()) but that does not work, unfortunately.
Is it possible to achieve this some other way?
camelCase(fileNameWithoutExtension())
It's a correct syntax.
Is it possible to achieve this some other way?
Please ensure that Skip if defined checkbox is checked for this variable.
If I try to wrap fileNameWithoutExtension() inside camelCase() and press enter to save the entry the window is closed but the change is not saved
It's an IDE bug (https://youtrack.jetbrains.com/issue/IDEA-132965 -- supposed to be fixed in current 2017.1.x version).
In any case: either press Enter before leaving the field ... or click on OK button straight away (you may then reopen this window to do further changes).
Also, when editing the field it's rendered like a select box which is kind of weird. Maybe it's a bug in this specific version. I'm on PhpStorm 10.0.4 for Mac.
Not a Mac user here .. but it is an editable drop-down box indeed (it lists all possible functions).

h:selectManyMenu - how to prevent someone from changing value but not disabled

I want to show a h:selectManyMenu with some selected Values. The user should be able to scroll and see the values, but should not be able to change anything. But if I set disabled to true, then the menu is disabled and is not scrollable. Are there any ways of doing it? I am using primefaces 3.5
As the name of the component says it's a "select" many menu, which is intended to be used to select values. It would be illogical to disable this functionality.
You should try to take a look at different components like the DataList:
http://www.primefaces.org/showcase/ui/dataListHome.jsf
Perhaps combined with a ScrollPanel:
http://www.primefaces.org/showcase/ui/scrollPanel.jsf

java swing, simulate JTable terminateEditOnFocusLost behaviour

putClientProperty("terminateEditOnFocusLost", Boolean);
to make jtable end editing and clear current selected rows when it lose focus or when simply click over an other GUI component.
This is very useful, but with "terminateEditOnFocusLost" there are some strange behaviours if it is used with editCellAt and changeSelection.
There are also some undesiderable TableModelEvents fired for some fake table updates.
So, im looking for an hack to simulate "terminateEditOnFocusLost without using it, is this possibile?
Thanks all.
Overload the function to make it suit your needs.
No hack at this moment.
putClientProperty("terminateEditOnFocusLost", Boolean) seem to be the only correct way.

Web page field validation

I need to validate a date/time field on a webpage but want it to do it without reloading the page and would like 'instant' feedback for the users.
What's the best/easiest solution.
BTW: easiest scores 65% of total points
Edit:
What if best was 65% of total points?
If you would like to use JavaScript then it has built in date validation functions. However, if you do not want to go the JavaScript route, you could change the UI to dropdown controls which would limit the users ability to enter invalid data. You would still need to check server side to ensure nobody submits Feb 30th.
Check out this javascript date validation function.
It uses javascript, regular expressions and the 'onblur' event of a text input.
#David H. Aust
Using onblur for validation is problematic, because some folks use the enter key, not the mouse, to submit a form. Using onblur and the form's onsubmit event in conjunction could be a better solution. Back when I did JS validation for forms a lot more, I would run against keyup events. This gave the user instant feedback on whether or not their entry was correct. You can (and I did) also put checks in place so that the user doesn't receive an "incorrect" message until they've left the field (since you shouldn't tell them they're incorrect if they aren't done yet).
I would recommend using drop-downs for dates, as indicated above. I can't really think of any reason not to--you want the user to choose from pre-defined data, not give you something unique that you can't anticipate.
You can avoid February 30 with a little bit of Javascript (make the days field populate dynamically based on the month).
#Brian Warshaw
That is a really good point you make about not forgetting the users who navigate via the keyboard (uh, me).
Thanks for bringing our attention to that.
A simple javascript method that reads what's in the input field on submit and validates it. If it's not valid, return false so that the form is not submitted to the server.
... onSubmit="return validateForm();" ...
Make sure you validate on the server side too, it's easy to bypass javascript validation.
If you're using ASP.NET, it has validator controls that you can point to textboxes which you can then use to validate proper date/time formats.
There are a couple of date widgets available out in the aether. Then you can allow only valid input.
I've used this small bit of js code in a few projects, it'll do date quickly and easily along with a few others.
Link
Looks like there's a great video about the ASP.NET AJAX Control Toolkit provides the MaskedEdit control and the MaskedEditValidator control that works great. Not easy for beginners but VERY good and instant feedback.
Thanks for all the answers though!
asp.net
Unfortunately I can't accept this answer.