Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid: showing calendar / suggesting current date in <b:dateTimePicker> #590

Closed
ruanfelisky opened this issue Dec 18, 2016 · 24 comments · Fixed by #610
Closed

Avoid: showing calendar / suggesting current date in <b:dateTimePicker> #590

ruanfelisky opened this issue Dec 18, 2016 · 24 comments · Fixed by #610
Assignees
Milestone

Comments

@ruanfelisky
Copy link

When the <b:dateTimePicker> gets focus, the calendar is automatically shown, and if the input is still blank it suggests the current date.

Is it possible to implement a way to avoid both behaviors or one of these individually?

I'd like to show the calendar only when the user click on the calendar icon (which also is not doing), and also not to suggest the current date every time I pass on it.

Thanks in advance.

@ruanfelisky
Copy link
Author

Maybe the fact of not showing the calendar automatically, already solves the "problem" of suggesting the date.

@stephanrauh
Copy link
Collaborator

@ruanfelisky Have a look at http://www3.bootsfaces.net/Showcase/forms/DateTimePicker.jsf. You can use the option allow-input-toggle to determine whether the calendar is opened when getting the focus or not.

@stephanrauh
Copy link
Collaborator

The other problem should be solved by setting use-current="false".

@stephanrauh
Copy link
Collaborator

Actually, now it does. We've confused the default value of use-current, so it had no effect. Now it has.

@stephanrauh
Copy link
Collaborator

You can run a test using the BootsFaces-1.1.0-SNAPSHOT on Maven Central. See #369 on how to get it.

@ruanfelisky
Copy link
Author

ruanfelisky commented Jan 4, 2017

@stephanrauh I've tested and there is no difference in changing the option allow-input-toggle. Using false or true the calendar is shown when getting focus (using BootsFaces-1.1.0-SNAPSHOT).

About the option use-current is working fine.

stephanrauh added a commit that referenced this issue Jan 4, 2017
@stephanrauh stephanrauh reopened this Jan 4, 2017
@stephanrauh
Copy link
Collaborator

@mtvweb Jens, it seems your pull request had some side effects:

  • the inline mode was broken
  • the attribute allow-input-toggle was broken.

Which errors did you PR fix? You've reported errors in your comments without mentioning which errors you've observed. In theory, these errors should be there again (see http://www3.bootsfaces.net/Showcase/forms/DateTimePicker.jsf).

@stephanrauh stephanrauh self-assigned this Jan 4, 2017
@stephanrauh stephanrauh added this to the v1.1.0 milestone Jan 4, 2017
mtvweb pushed a commit to mtvweb/BootsFaces-OSP that referenced this issue Jan 4, 2017
The assignment of the JQuery identifier wasn't correct in the different
cases, "inline", "popup". Also there was a difference between rendering
with an assigned id and with none id.

Fix TheCoder4eu#590
@mtvweb
Copy link

mtvweb commented Jan 4, 2017

The error in the PR regarding DataTimePicker are only related to the assigned JQuery id. Sometimes it was correct, sometimes not. As you can see at the DateTimePicker.jsf demo page, the "Embedding DateTimePicker in a form" isn't working any more.

I've added a fix to my fork. It was confusing about the used id's.Depending on the properties it differs with the assigned form:id and DTP_CONTAINER_ID prefixes.

Hopefully now all cases are working.

@ruanfelisky
Copy link
Author

Hi guys, the current 1.1.0-SNAPSHOT has that last correction?
As soon as it's available, I'll test it on my project.
Thanks.

@stephanrauh
Copy link
Collaborator

I've just uploaded the file. Happy testing!

@ruanfelisky
Copy link
Author

There's only one problem, when I click over the icon, the calendar is not showing. It's strange right? Because in the showcase it's working properly. My code is:

<b:dateTimePicker allowInputToggle="false" useCurrent="false" label="Data" 
   value="#{myBean.date}" format="DD/MM/YYYY" fieldSize="sm" />

@mtvweb
Copy link

mtvweb commented Jan 5, 2017

Find a snapshot build of my mtvweb-fork at:

https://www.dropbox.com/s/pyx200ngh7shgjc/BootsFaces-OSP-1.1.0-20170105.jar?dl=0
https://www.dropbox.com/s/otojqa1xkma55og/BootsFaces-OSP-default-1.1.0-20170105.jar?dl=0

feel free to check if this is working well with your project

@stephanrauh
Copy link
Collaborator

@mtvweb Yes, this stuff is confusing :). I hope we manage to solve the id issues soon. In the case of the dateTimePicker, it's important to call $(id).dateTimePicker() with the outer ID. If the inline mode is active, there's not input field at all, and if there's a calendar icon right or left to the input field, we want it to be part of the datePicker, too. Otherwise clicking the icon doesn't do anything.

@stephanrauh
Copy link
Collaborator

stephanrauh commented Jan 5, 2017

@ruanfelisky I've copied your snipped into the showcase, and it works just fine. Clicking the icon shows the calendar. Really strange. Maybe you've got an old snapshot - be it because my upload didn't work, or be it because of a nasty caching problem?

@mtvweb
Copy link

mtvweb commented Jan 5, 2017

@stephanrauh You're right. I was stumbled by the different cases for the previous change. Have you tried my yesterdays change? I think it is correct now, but I haven't added a PR before I am not sure that it is working in all cases.

I have checked it with the Bootsfaces Showcase with my build and in my project. In any case it is working for me now. The current Showcase doesn't work completely. Check the datetimepicker in the section "Embedding a DateTimePicker in a form"

mtvweb@f5ee461

@mtvweb
Copy link

mtvweb commented Jan 6, 2017

I've discovered a funny thing with the "inline" mode.

It is working well for me with Java 8 but not with Java 7. But I can't locate any Java 8 specific code in the DateTimePicker source.

See http://cubie1.ddns.net/BootsFacesWeb/forms/DateTimePicker.jsf for a working example.
(Sorry it is a little bit slow, because it is running only on an ArmV7 Cubietruck with Apache/TomEE-Plume/Java8)

If I run it with Java7, inline behavior is like https://showcase.bootsfaces.net/forms/DateTimePicker.jsf. Toggle inline mode results in an empty rendering.

@stephanrauh
Copy link
Collaborator

@mtvweb @TheCoder4eu Do we have a showcase running on Java 7? I don't have Java 7 on my PC, so I can't test the bug.

@mtvweb
Copy link

mtvweb commented Jan 7, 2017

I have setup another instance for Java7 (web app and tomcat is the same, only running on a different ajp port and another JAVA_HOME)

For Java 1.8.0_111 use:

http://cubie1.ddns.net/BootsFacesWeb/forms/DateTimePicker.jsf

and for Java 1.7.0_51

http://cubie1.ddns.net/BootsFacesWeb7/forms/DateTimePicker.jsf

@ruanfelisky
Copy link
Author

It seems that running in Java 7 really has some bugs in <b:dateTimePicker>.

I'm using Java 1.8.0_111 in my project. I will download the BootsFaces-1.1.0-SNAPSHOT again and test to see if the problem regarding the icon has been resolved.

@stephanrauh
Copy link
Collaborator

I can reproduce the bug with your new URL. But are you sure it's a Java bug? The real source of the problem seems to be that moment.js is loaded after the dateTimePicker.min.js, but the latter requires the former:

image

@stephanrauh
Copy link
Collaborator

stephanrauh commented Jan 7, 2017

It's possible that the HashMap algorithm has been changed between Java 7 and Java 8.

@stephanrauh
Copy link
Collaborator

I've prepared a bugfix, but I'm not sure we'll include it in the 1.0.2 version we'd like to publish this weekend. My bugfix involves the AddResourcesHandler, and that's a very central class that has caused us a lot of trouble. We've learned to modify it carefully.

TheCoder4eu added a commit that referenced this issue Jan 7, 2017
@mtvweb
Copy link

mtvweb commented Jan 8, 2017

I've compiled the current version from this repository, "inline" is working now, even in Java 7.

But there is still the Id-Issue in it.

I've added a PR #610 for this, because it is fixed in my repository. My current showcases are now:

icon issue

@stephanrauh
Copy link
Collaborator

This should be fixed by now. See http://www3.bootsfaces.net/Showcase/forms/DateTimePicker.jsf. I've uploaded a new snapshot of 1.1.0 so you can test it yourself.

BTW, thanks for being so tenacious! I always looked in the wrong spots, so I didn't see the error. Too bad the bug made it into the 1.0.2 version. The main purpose of this version was to fix the dateTimePicker, along with the colorPicker and one or two other components. Sigh!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants