Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Input field for time only?

Harri Salminen
1 decade ago Apr 20, 2010 7:55pm
Marko Grönroos
1 decade ago Apr 20, 2010 9:18pm
Harri Salminen
1 decade ago Apr 22, 2010 2:59pm
Jack Hu
8 years ago Jan 23, 2014 4:55am
Marius Reinwald
8 years ago Jan 23, 2014 10:31am
Michal Sterba
7 years ago Jan 18, 2015 11:10am
Agata Vackova
7 years ago Feb 02, 2015 3:22pm
Deleted User
6 years ago Jun 23, 2015 7:32am

I found a solution for that :)

simply hide the calender part by CSS: 

java code:
InlineDateField date=new InlineDateField("Time: ");
date.setResolution(Resolution.MINUTE);
layout.addComponent(date);

CSS rule:
.v-inline-datefield-calendarpanel-header,.v-inline-datefield-calendarpanel-body{
  display: none;
  }

keep in mnd that the generated CSS rules for PopupDateField are different

Jens Jansson
6 years ago Jun 23, 2015 8:16am
Agata Vackova
6 years ago Jun 23, 2015 12:19pm
Jens Jansson
6 years ago Jun 23, 2015 12:24pm

Give the datefield a stylename:

date.addStyleName("time-only");

target the CSS to only those fields that has the time-only class name:

.time-only .v-inline-datefield-calendarpanel-header,
.time-only .v-inline-datefield-calendarpanel-body {
  display: none;
}
Agata Vackova
6 years ago Jun 23, 2015 1:12pm
Jose Escoto
6 years ago Feb 22, 2016 9:57pm

is there a way to set the time fields nullable?

Peter Hansson
4 years ago Jan 22, 2018 6:19am
Jure Vengušt
3 years ago Jun 08, 2018 8:29am
Thomas Schulz
12 months ago Oct 21, 2020 9:37am